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 change color of text in Qtreeview

How to change color of text in Qtreeview

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.1k 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    How to change color of text in Qtreeview

    JonBJ 1 Reply Last reply
    0
    • Q Qt Enthusiast

      How to change color of text in Qtreeview

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Qt-Enthusiast
      Many ways. If your QTreeView has a model, one way is via the model's data() method, look at the possible role values parameter to that. That's assuming you want the color to vary per item. If you only want to change all texts' color there are simpler ways.

      1 Reply Last reply
      3
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        I want to change per item

        JonBJ 1 Reply Last reply
        0
        • Q Qt Enthusiast

          I want to change per item

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Qt-Enthusiast
          So like I said, look at http://doc.qt.io/qt-5/qabstractitemmodel.html#data and http://doc.qt.io/qt-5/qt.html#ItemDataRole-enum (Qt::ForegroundRole).

          1 Reply Last reply
          4

          • Login

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