Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. text color
    Log in to post

    • SOLVED How to change color of last character in QML Text?
      QML and Qt Quick • qml text text color • • Babs  

      5
      0
      Votes
      5
      Posts
      357
      Views

      @J-Hilk thank you
    • SOLVED How to change the Text Color of a List Item ?
      General and Desktop • list qcolor qbrush text color • • Sphinkie  

      6
      0
      Votes
      6
      Posts
      1614
      Views

      @Sphinkie Wow, I had not noticed there is such a namespace since I'm still mainly using 5.12. If the constants are QColor objects as the doc says, then you should be able to use them directly like w->setForeground(QColorConstants::Red); w->setBackground(QColorConstants::Yellow);
    • UNSOLVED QListView add item text customization
      General and Desktop • qlistview text color • • Kaluss  

      3
      0
      Votes
      3
      Posts
      2467
      Views

      First of all, as mentioned in the docs, Qt::TextColorRole is obsolete and you should not use it. Use Qt::ForegroundRole instead. Second, as mentioned by @alex_malyu, it depends on the model whether or not it implements that. QStandardItemModel for example will, but your custom model might not. So the question is what is your model class.