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

closing QComboBox popup with Escape key also closes QDialog on macOS

XMLWordPrintable

    • macOS
    • a87408750 (dev), f8b151891 (6.4), 7107b4ae5 (6.4), c95de359b (dev)

      Escape key press is somehow propagated to parent dialog when combo box popup is closed with it. As a result, the dialog gets closed.

      Consider this code.

      #include <QApplication>
      #include <QComboBox>
      #include <QDialog>
      #include <QVBoxLayout>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QDialog w;
          auto vbox = new QVBoxLayout();
          w.setLayout(vbox);
          auto combo = new QComboBox();
          vbox->addWidget(combo);
          combo->addItems({"A", "B", "C"});
          w.open();
          return a.exec();
      }
      

      Steps to reproduce:
      1) run the code
      2) click the combo box to open the popup
      3) press Escape to close the popup

      Actual behavior:

      • Dialog is closed.

      Expected behavior:

      • Only popup is closed but not dialog.

      This bug seems to exist only on macOS, everything seems to work well on Windows and Linux.

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

            vhilshei Volker Hilsheimer
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: