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

QComboBox fusion style fails with stylesheet if no parent before setEditable

XMLWordPrintable

    • 29d3b9745b4ba57cd79c95a96659f97c85c3b4ee, c4430ed02301c456dd591c88049ee22bc7dd9725

      Use any application stylesheet (also " ") with fusion style and use editable QComboBox which parent is set after setEditable. You will see incorrect style. Looks like it's mixed native/fusion style where item size height is from fusion but colors are from native. See attachments to see difference.

      Issue can be also seen when using UI forms with layouts and style combination which doesn't care order when setting parent to combobox.

      Here's simple example to reproduce and test issue:

      #include <QApplication>
      #include <QWidget>
      #include <QStyleFactory>
      #include <QComboBox>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          a.setStyle(QStyleFactory::create("fusion"));
          a.setStyleSheet(" ");
          // use empty style sheet to see correct style
      //    a.setStyleSheet("");
          QWidget* w = new QWidget();
          QComboBox* test = new QComboBox();
          // or set parent before setEditable to see correct style
      //    test->setParent(w);
          test->setEditable(true);
          test->addItem("test1");
          test->addItem("test2");
          test->addItem("test3");
          test->setParent(w);
          w->show();
          a.exec();
      }
      

        1. fusionstyle.png
          fusionstyle.png
          8 kB
        2. mixedstyle.png
          mixedstyle.png
          8 kB
        3. nativestyle.png
          nativestyle.png
          8 kB
        4. stylebug_wa.zip
          3 kB
        5. stylebug.zip
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            qtcomsupport Qt Support
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes