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

Incorrect display of :selected state of QCombobox on "windows" style plugin

    XMLWordPrintable

Details

    • All
    • a77a7c157 (dev), bea1e9f73 (6.8)

    Description

      With the "windows" style plugin loaded, rendering of QComboBox:selected is incorrect if a border is defined. The result is that text is rendered as white, and the "color:" attribute has no effect.
       

      #include <QtWidgets>
      
      int main(int argc, char* argv[]) {
        QApplication a(argc, argv);
      
        a.setStyle("windows");
      
        a.setStyleSheet(R"QSS(
          * {
            color: black;
            background-color: darkgrey;
          }
          QComboBox {
            background-color:white;
          }
          QComboBox:selected {
            background-color: yellow;
            border: 1px solid magenta;
          }
          QPushButton {
            border: 1px solid gray;
          }
          QPushButton:selected {
            border: 1px solid magenta;
          }
        )QSS");
      
        auto* window = new QWidget;
        auto* cb = new QComboBox(window);
        cb->insertItems(0, {"Fee", "Fi", "Fo", "Fumm"});
      
        auto* btn = new QPushButton("Button", window);
      
        auto* layout = new QVBoxLayout(window);
        layout->addWidget(cb);
        layout->addWidget(btn);
      
        window->move(qApp->primaryScreen()->geometry().center());
        window->show();
        return a.exec();
      }

       

      Attachments

        1. CMakeLists.txt
          2 kB
        2. image-2024-12-01-15-45-40-880.png
          image-2024-12-01-15-45-40-880.png
          4 kB
        3. main.cpp
          0.8 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            scrubbbbs John Dorian
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes