Results 1 to 3 of 3

Thread: how to shift the focus to enter

  1. #1

    Default how to shift the focus to enter

    I tried using this way but I did not succeed, the focus disappears and does not go to the next.

    Qt Code:
    1. void Login::keyPressEvent(QKeyEvent *event)
    2. {
    3. if(event->key()==Qt::Key_Enter)
    4. {
    5. this->nextInFocusChain()->setFocus();
    6.  
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

    thanks for help!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to shift the focus to enter

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: how to shift the focus to enter

    Thanks, is perfect.

    Qt Code:
    1. void Login::keyPressEvent(QKeyEvent *event)
    2. {
    3. if(event->key()==Qt::Key_Enter)
    4. {
    5. this->focusNextPrevChild(true);
    6.  
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 14th September 2008, 23:05
  2. Replies: 15
    Last Post: 26th July 2007, 21:04
  3. Focus issues / Setting multiple focus
    By ComputerPhreak in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2007, 06:09
  4. Tab/Enter focus problem
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 23rd October 2006, 23:34
  5. Replies: 3
    Last Post: 26th September 2006, 12:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.