Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QTreeView - Item to have multiple colours

    General and Desktop
    3
    3
    410
    Loading More Posts
    • 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.
    • K
      kumararajas last edited by

      Hello,

      Is there a way that, I can set multiple colours on the item being displayed?

      Example:

      |
      --- Hello World
         |
         --- My Data
         |
      

      In this, I want to show Hello in blue colour, World in red colour. And "My" in purple colour and "Data" in black colour.

      How to achieve this?

      Thanks for your help in advance.

      --Kumara

      --Kumar

      1 Reply Last reply Reply Quote 0
      • T
        takoo last edited by

        You must research Qregexp and QTextCursor

        I just write code ------- (-_-) ----------

        1 Reply Last reply Reply Quote 0
        • Ni.Sumi
          Ni.Sumi last edited by

          hi @kumararajas ,

          seems, you can achieve this using QStyledItemDelegate::paint(painter, newOption, index); .
          Check this post.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post