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

QPushButton keyboard shortcut broken in 5.6.0

    XMLWordPrintable

Details

    Description

      Not sure if this is related to some recent fixes regarding shortcut handling, but on 4.8.7, 5.2.1 and 5.5.1, the attached test case prints "clicked" when Ctrl+O is pressed, as expected. On 5.6.0 it prints nothing.

      Showing the code inline here as well:

      #include <QApplication>
      #include <QMainWindow>
      #include <QPushButton>
      #include <QKeySequence>
      #include <QWidget>
      #include <QDebug>
      
      class MainWindow : public QMainWindow {
          Q_OBJECT
      
      public:
          MainWindow(QWidget *parent = 0) : QMainWindow(parent) {
              QPushButton *button = new QPushButton("Click Me (Ctrl+O)");
              button->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
              connect(button, SIGNAL(clicked()), this, SLOT(onClicked()));
      
              setCentralWidget(button);
          }
      
      public slots:
          void onClicked() {
              qDebug() << "clicked";
          }
      };
      
      int main(int argc, char *argv[]) {
          QApplication app(argc, argv);
      
          MainWindow window;
          window.show();
      
          return app.exec();
      }
      
      #include "moc_test.cpp"
      

      Attachments

        1. test.pro
          0.1 kB
        2. test.cpp
          0.7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paeglis Gatis Paeglis
            estan Elvis Stansvik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes