Results 1 to 2 of 2

Thread: Highlighting QTreeWidgetItem

  1. #1
    Join Date
    Jul 2008
    Location
    India
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Highlighting QTreeWidgetItem

    When I was trying to highlight selected QTreeWidgetItem the display is not proper as expected. I expected the behaviour should highlight only the text portion of the QTreeWidgetItem, but iam getting the highlight till the end of the widget area and is not proper. I have used the below code in the constructorof my class.

    Qt Code:
    1. QPalette palette = QPalette();
    2. palette.setColor(QPalette::HighlightedText, Qt::white);
    3. palette.setColor(QPalette::Highlight, Qt::blue);
    4. setPalette(palette);
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance.
    Last edited by jpn; 27th July 2008 at 10:30. Reason: missing [code] tags

  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: Highlighting QTreeWidgetItem

    I guess what u want is not acheivable directly.
    You can achieve it using item delegates. In the delegate u can set the textcharformat for the string....

Similar Threads

  1. Custom QTreeWidgetItem context menu?
    By AaronMK in forum Qt Programming
    Replies: 4
    Last Post: 1st February 2010, 04:42
  2. Replies: 3
    Last Post: 26th April 2008, 18:42
  3. select a QTreeWidgetItem
    By mattia in forum Newbie
    Replies: 2
    Last Post: 21st December 2007, 11:01
  4. QTreeWidgetItem ?
    By allensr in forum Qt Programming
    Replies: 5
    Last Post: 3rd January 2007, 17:51
  5. QTreeWidgetItem swap or move up one level problem
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 24th September 2006, 18: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.