Results 1 to 2 of 2

Thread: Need help setting the QTreeView selectedItem color

  1. #1
    Join Date
    Nov 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Need help setting the QTreeView selectedItem color

    Hey gang,
    I'm using Qt 4.8.0 and I have a QTreeview object where I am trying to set the selected color. I've been reading docs and I assume this is the Hightlighted color. Stylesheets are not working and the following code is also not working:
    QPalette p = ui._librariesView->palette();
    p.setColor(QPalette::HighlightedText, Qt::red);
    p.setColor(QPalette::Highlight, Qt::red);
    ui._librariesView->setPalette(p);
    please help.
    Thanks
    /Loren

  2. #2
    Join Date
    Feb 2011
    Location
    Romania
    Posts
    53
    Thanks
    1
    Thanked 11 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Need help setting the QTreeView selectedItem color

    Maybe you should use item delegate for displaying selected items as you want.
    Reimplement QItemDelegate:: paint and follow the example from docs.

Similar Threads

  1. Saving color setting
    By waynew in forum Qt Programming
    Replies: 10
    Last Post: 13th January 2015, 14:15
  2. color setting idiom
    By ugluk in forum Qt Programming
    Replies: 6
    Last Post: 26th July 2011, 21:19
  3. Setting Background Color
    By SixDegrees in forum Qt Programming
    Replies: 5
    Last Post: 16th February 2011, 19:33
  4. How can I get System setting color
    By dpatel in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2010, 09:20
  5. setting text also changes color?
    By drhex in forum Qt Programming
    Replies: 5
    Last Post: 22nd November 2006, 17:36

Tags for this Thread

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.