Results 1 to 2 of 2

Thread: bg color of current item for a QTreeView

  1. #1
    Join Date
    Apr 2006
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default bg color of current item for a QTreeView

    Hello!

    I need to set the background color of the current cell in a QTreeView. I'd prefer to do this with QSS stylesheets, because the app is already using a lot of that.

    I can do this:

    Qt Code:
    1. MyTreeView {
    2. selection-background-color: lightGreen;
    3. selection-color: white;
    4. }
    To copy to clipboard, switch view to plain text mode 

    But that sets the background for the whole selected row, not just the currently active cell.

    thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: bg color of current item for a QTreeView

    Use the "::item" subcontrol.

    css Code:
    1. MyTreeView::item:active {
    2. background-color: lightgreen;
    3. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTreeView, QSortFilterProxyModel and item expansions
    By benacler in forum Qt Programming
    Replies: 3
    Last Post: 21st May 2008, 20:30
  2. Distributing QT application for Mac OS
    By mb0 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2007, 18:59
  3. Replies: 15
    Last Post: 21st April 2007, 17:46
  4. Replies: 1
    Last Post: 19th April 2007, 22:23
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 14:24

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.