Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt5: Styling the checkbox of a checkable QTreeWidgetItem

Qt5: Styling the checkbox of a checkable QTreeWidgetItem

Scheduled Pinned Locked Moved Solved General and Desktop
qt5qtreewidgetitemqtreewidgetstylesheet
2 Posts 1 Posters 3.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jakob
    wrote on 3 Dec 2015, 15:26 last edited by
    #1

    In my app I have stylesheets for QCheckBox. I created a QTreeViewWidget with QTreeWidgetItems that has been made checkable by setting the flag Qt::ItemIsUserCheckable.

    I was expecting that the checkbox that is displayed will by styled according to the already existing QCheckBox styles. Unfortunately that doesn't happen. This begs the question: how to 'access' that checkbox of the QTreeWidgetItems?

    I tried QTreeView::item as well as QTreeView::indicator and also the combination QTreeView::item::indicator, none of which seem to function. So what is the correct syntax?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jakob
      wrote on 10 Dec 2015, 15:29 last edited by
      #2

      As it turned out, one must explicitly say QTreeView::indicator:unchecked in order to set the general settings like background color for this checkbox. That was a bit surprising, as this is not needed for instance for QCheckbox::indicator or QGroupBox::indicator, but the solution is now here for posterity

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved