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

QTreeView: stylesheet :has-children pseudo selector doesn't works for the ::item pseudo-class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.0
    • 4.4.3
    • Widgets: Style Sheets
    • None
    • 5ff7b773a0f59e174001da1f0550a7f0c2b6f485

    Description

      Trying to set a background color for items with children in a QTreeView using style sheet using QTreeView::item:has-children does not work.
      It seems that the has-children pseudo-state is not supported for QTreeView::item.

      Example code:

      #include <QtGui>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);

      QDirModel model;
      QTreeView tree;
      tree.setModel(&model);

      tree.setStyleSheet("QTreeView::item:has-children

      {background: rgb(153, 204, 0);}

      ");

      // Demonstrating look and feel features
      tree.setAnimated(false);
      tree.setIndentation(20);
      tree.setSortingEnabled(true);

      tree.setWindowTitle(QObject::tr("Dir View"));
      tree.resize(640, 480);
      tree.show();

      return app.exec();
      }

      Attachments

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

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            xcm Martin Petersson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes