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

[REG 4->5] Windows: QComboBox popup becomes "detached" if parent widget is scrolled with the mouse wheel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0
    • 5.1.1, 5.3.0
    • None
    • Windows 7
    • 92c7cb815522ad1b31e98cc1e7adeabde58057da (5.4. ,27.8.2014, 5.4)

    Description

      If I put a QComboBox in a scrollable parent (e.g., QScrollArea, but also QTreeView etc.), open the combo's popup, and then mouse-wheel scroll the parent, the popup does not scroll with the rest of the combo.

      Minimal example:

      #include <QApplication>
      #include <QLabel>
      #include <QComboBox>
      #include <QLayout>
      #include <QScrollArea>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          // Create a layout
          auto layout = new QVBoxLayout();
          layout->setSizeConstraint( QLayout::SetMinAndMaxSize );
      
          // Add some labels for filler
          for( int i=0; i < 10; ++i )
          {
              layout->addWidget( new QLabel( "Blah" ) );
          }
      
          // Create a combobox and add to layout
          auto cmb = new QComboBox();
          cmb->addItems( QStringList() << "Won" << "Too" << "3" << "fore" );
          layout->addWidget( cmb );
      
          // Add some labels for filler
          for( int i=0; i < 10; ++i )
          {
              layout->addWidget( new QLabel( "Blah" ) );
          }
      
          // Put in a widget
          auto widget = new QWidget();
          widget->setLayout( layout );
      
          // Put in a scroll area
          auto scroll = new QScrollArea();
          scroll->setWidget( widget );
          scroll->show();
      
          return a.exec();
      }
      

      I've attached a screenshot that shows the problem.

      This is all on Windows. On Linux with Qt 5.3.0 and the same code as above, I do not see this problem because the scroll area does not respond to mouse wheel events while the child combo is open.

      Attachments

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              mlimber mlimber
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes