Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69910

setDefault on a button from a QDialogButtonBox affects the wrong button when on GnomeLayout

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.11.1
    • None
    • Linux/X11

      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

       

       

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            albertvaka Albert Vaca Cintora
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes