Results 1 to 3 of 3

Thread: QPushButton, QTabOrder and return key

  1. #1
    Join Date
    Jan 2006
    Posts
    73
    Thanks
    16
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QPushButton, QTabOrder and return key

    Hello,
    I have created two buttons:
    Qt Code:
    1. cancelButton = new QPushButton("Cancel");
    2. layout->addWidget(cancelButton, 2, 0);
    3. submitButton = new QPushButton("Submit");
    4. layout->addWidget(submitButton, 2, 1);
    To copy to clipboard, switch view to plain text mode 
    and connected them like this
    Qt Code:
    1. connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
    2. connect(submitButton, SIGNAL(clicked()), this, SLOT(checkLogin()));
    To copy to clipboard, switch view to plain text mode 
    then, I specified some tabordering
    Qt Code:
    1. setTabOrder(usernameLine, passwordLine);
    2. setTabOrder(passwordLine, submitButton);
    3. setTabOrder(submitButton, cancelButton);
    To copy to clipboard, switch view to plain text mode 
    once the password is entered and I press tab, the submitButton is highlighted but pressing the return key on my mac does not trigger anything. If I click the button with the mouse, it works fine. I am using Qt 4.2.0-rc1.
    Thanks for any help

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton, QTabOrder and return key

    AFAIR return key activates the default button, while space activates the button with focus.

  3. The following user says thank you to jacek for this useful post:

    jcr (21st September 2006)

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

    Default Re: QPushButton, QTabOrder and return key

    I think you should specify the submit button as "autodefault" or "default".

  5. The following user says thank you to wysota for this useful post:

    jcr (21st September 2006)

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.