Results 1 to 2 of 2

Thread: How to set a specific color of a text item into a QListBox ?

  1. #1
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default How to set a specific color of a text item into a QListBox ?

    Hello,

    The title is explicit

    I use quite often QListBox widget to display traces when proceeding to unitary tests of my classes. I wonder if it is possible to set the color of the text items that are inserted into the list box. For example I want to insert a text line in black, then I want the next text line to be inserted to be red or any other color.

    Is it possible to do such a thing ?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to set a specific color of a text item into a QListBox ?

    I think you must subclass QListBoxItem and reinplement his protected method paint().And then use QPainter fuctionality.
    a life without programming is like an empty bottle

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 10:49
  2. how change the QListBox item position by pixel
    By roy_skyx in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2006, 02:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.