Results 1 to 2 of 2

Thread: QListWidget syntax highlight

  1. #1
    Join Date
    Dec 2006
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QListWidget syntax highlight

    is it possible to apply QSyntaxHighlighter to QListWidget?

    I was looking at the Qt source and was planning to subclass QSyntaxHyghlighter to accept QListWidget or QListWidgetItems instead of QTextDocument and/or subclass QListWidget/QListWidgetItems that I could pass to the constructor of QSyntaxHighlight but it doesn't seem to be possible, or am I looking at the wrong places? Version 4.0 used to have a setBackgroundColor and setTextColor for QListWidget but that was replaced with stylesheet that might complicate what I'm trying to do.

    Any help would be appreciated. Thanks.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QListWidget syntax highlight

    is it possible to apply QSyntaxHighlighter to QListWidget?
    Yes,, with delegates..
    Have a look at QItemDelegate and QStyledItemDelegate. You can use a syntax highlighter in the delegate class and draw the text colored as per the highlighter

Similar Threads

  1. highlight in QTextEdit
    By ubuntudevelop78 in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2009, 00:22
  2. QTableWidget || QListWIdget with syntax highlighting
    By ericV in forum Qt Programming
    Replies: 7
    Last Post: 21st August 2009, 13:26
  3. Odd Syntax
    By acxdotfm in forum Qt Programming
    Replies: 2
    Last Post: 24th October 2008, 20:23
  4. Replies: 2
    Last Post: 12th October 2008, 14:42
  5. Syntax highlight selection problem
    By s.toonen in forum Qt Programming
    Replies: 9
    Last Post: 4th June 2008, 12:15

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.