PDA

View Full Version : QPushButton, QTabOrder and return key



jcr
21st September 2006, 17:16
Hello,
I have created two buttons:


cancelButton = new QPushButton("Cancel");
layout->addWidget(cancelButton, 2, 0);
submitButton = new QPushButton("Submit");
layout->addWidget(submitButton, 2, 1);

and connected them like this


connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
connect(submitButton, SIGNAL(clicked()), this, SLOT(checkLogin()));

then, I specified some tabordering


setTabOrder(usernameLine, passwordLine);
setTabOrder(passwordLine, submitButton);
setTabOrder(submitButton, cancelButton);

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

jacek
21st September 2006, 17:21
AFAIR return key activates the default button, while space activates the button with focus.

wysota
21st September 2006, 17:21
I think you should specify the submit button as "autodefault" or "default".