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

Selector QTreeView::indicator not working in Qt6

XMLWordPrintable

      The `QTreeView::indicator` selector does not seem to work in Qt6.

      Example:

      #include <QApplication>#include <QTreeWidget>
      int main(int argc, char* argv[]){    
          QApplication app(argc, argv);    
      
          app.setStyleSheet(R"(
      QAbstractItemView { color: #DCDCDC;  background-color: #1E1E1E;  alternate-background-color: #262626;  border-color: #3F3F46; }
      QAbstractItemView::item:selected,QAbstractItemView::item:selected:hover { background-color: #3399FF;  color: #F1F1F1; }
      QTreeView::indicator { background-color: #2D2D30;  border-color: #3F3F46;  width: 13px;  height: 13px;  border-style: solid;  border-width: 1px; }
      QTreeView::indicator { width: 15px;  height: 15px; }
          )");
         
          QTreeWidget *w = new QTreeWidget();    
          w->setAlternatingRowColors(true);    
          
          QTreeWidgetItem *wa = new QTreeWidgetItem({"a"}),        
              *wb = new QTreeWidgetItem({"b"});
      
          wa->setCheckState(0, Qt::CheckState::Unchecked);    
          wb->setCheckState(0, Qt::CheckState::Checked);    
      
          w->addTopLevelItems({wa, wb});    
          w->show();
          
          return app.exec();
      }
      

      The `QCheckBox::indicator` selectors are working as expected, and the `QTreeView::indicator::hover` too. Only the `QTreeView::indicator` and `QTreeView::indicator::checked` are not working.

      This was working fine in Qt 5, the attached capture show the difference between Qt5 (style is correct on both checkboxes) and Qt6 (style is only correct for the selected checkbox).

      Might be related to QTBUG-1454

        1. capture-qt5.PNG
          capture-qt5.PNG
          3 kB
        2. capture-qt6.PNG
          capture-qt6.PNG
          2 kB
        3. main.cpp
          1 kB
        4. QTBUG-103107_Qt6_3_2.png
          QTBUG-103107_Qt6_3_2.png
          4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kagro Kaj Grönholm
            holt59 Mikaël Capelle
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes