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. QTreeWidget Indicator Checkmarks
Qt 6.11 is out! See what's new in the release blog

QTreeWidget Indicator Checkmarks

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.5k Views 1 Watching
  • 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
    JRCoder
    wrote on last edited by
    #1

    Is there anyway to change the color of the checkmarks on certain items in a qtreewidget and leave those of other items untouched? This is so that the user can see what was already checked off on a previous checklist, when making a new checklist.

    Or is there a way to set customized icons for the checkmarks instead of the built in checkmark icons?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      You can try to solve that via a custom item delegate. I'm not 100% sure, if the check marks are drawn by the delegate or by the painting routines of the view. So perhaps, those must b
      be overwritten then.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JRCoder
        wrote on last edited by
        #3

        Thanks Gerolf. Subclassing QStyledItemDelegate worked. I only had to reimplement the paint function. I painted the checkbox area of the items via QPainter::drawPixmap(QRect, QPixmap). I used QStyle::subElementRect(QStyle::SE_CheckBoxIndicator, &option, widget) to supply the QRect object and created the QPixmap object using customized icons.

        1 Reply Last reply
        0

        • Login

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