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. How to preserve QTreeView item's icon color ?

How to preserve QTreeView item's icon color ?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 879 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.
  • C Offline
    C Offline
    chinwe
    wrote on last edited by
    #1

    Hi
    Once a treeview's item is selected, it's icon color is multiplied by some color anyway! I mean, blue color on top of it.
    I tried many ways, but none worked.
    If anyone has any experience with something similiar...please share.
    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi and welcome to devnet,

      What version of Qt ?
      On what platform ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chinwe
        wrote on last edited by
        #3

        Thanks for reply.

        Qt5.9.6 on Windows 7.

        I have tried QSS and overload to disable QStyle::SH_ItemView_ShowDecorationSelected.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If you don't want the focus rect to apply to the icon, the best thing to do is to implement a custom QStyledItemDelegate and reimplement the paint method to do the normal painting and then you manual paint the icon on top.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          3
          • C Offline
            C Offline
            chinwe
            wrote on last edited by
            #5

            Wow, that’s great.
            My problem has been sloved.
            Thank you very much.

            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