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

QGroupBox swallows return key presses on GNOME

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15
    • None
    • Linux/Wayland, Linux/X11

    Description

      If the platform theme defines ButtonPressKeys, then QGroupBoxes swallow those unconditionally. This is very noticable in dialogs: If any component within a group box has focus, pressing return no longer accepts the dialog.

      This is a regression caused by https://codereview.qt-project.org/c/qt/qtbase/+/396253, earlier versions did not define any ButtonPressKeys.

      The cause is this code in qgroupbox.cpp:

          case QEvent::KeyPress: {
              QKeyEvent *k = static_cast<QKeyEvent*>(e);
              const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
                                                   ->themeHint(QPlatformTheme::ButtonPressKeys)
                                                   .value<QList<Qt::Key>>();
              if (!k->isAutoRepeat() && buttonPressKeys.contains(static_cast<Qt::Key>(k->key()))) {
                  d->pressedControl = QStyle::SC_GroupBoxCheckBox;
                  update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this));
                  return true;
              }
              break;
          }
      

      It should probably check for d->checkable?

      Attachments

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

        Activity

          People

            ndavis Noah Davis
            vogtinator Fabian Vogt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes