Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.11.1
-
None
Description
Calling setDefault on the 'Ok' button from a QDialogBoxButton, results in the 'Cancel' button actually being set as the default, when the desktop is Gnome. The same way, setting the 'Cancel' button as default makes the 'Ok' button be the default.
This is most likely because in Gnome the 'Ok' and 'Cancel' buttons have their places swapped due to QDialogBoxButton using its GnomeLayout.
Code to reproduce:
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); QPushButton* m_okButton = buttonBox->button(QDialogButtonBox::Ok); m_okButton->setDefault(true);
Very similar code can be found, in the KDE Konversation app, that shows the incorrect behaviour on Gnome:
https://cgit.kde.org/konversation.git/tree/src/irc/servergroupdialog.cpp#n457