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

QComboBox popup hides under a parent window with Qt::WindowStaysOnTopHint

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P1: Critical
    • Resolution: Duplicate
    • 5.6.2, 5.9.1
    • None
    • None
    • Windows 10

    Description

      Steps to reproduce:

      1. Create a widget with Qt::WindowStaysOnTopHint and add a QComboBox to it.
      2. Open the combo's popup and close it (works as expected).
      3. Click somewhere outside the app and then click inside it so it becomes active again.
      4. Open the popup again - it should show up as previously but instead it shows under the window.

      Sample code:

      #include <QApplication>
      #include <QMainWindow>
      #include <QComboBox>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          auto box = new QComboBox();
          box->addItems(QStringList() << "Foo" << "Bar");
      
          QMainWindow w(nullptr, Qt::WindowStaysOnTopHint);
          w.setCentralWidget(box);
          w.setContentsMargins(10,10,10,10);
          w.show();
      
          return a.exec();
      }
      

      Attached are screenshots of what it looks like before and after the active window switch.

      Attachments

        1. combo_after.jpg
          combo_after.jpg
          10 kB
        2. combo_before.jpg
          combo_before.jpg
          10 kB
        3. image-2017-07-20-12-25-05-750.png
          image-2017-07-20-12-25-05-750.png
          39 kB
        4. Popo截图2017720122422.png
          Popo截图2017720122422.png
          39 kB
        5. qtbug61804.zip
          1 kB

        Issue Links

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

          Activity

            People

              mmutz Marc Mutz
              chrisaverage Krzysztof Kawa
              Votes:
              5 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes