Results 1 to 2 of 2

Thread: How to set the decoration hightlighted when select a row in QTreeView

  1. #1
    Join Date
    Feb 2009
    Location
    Chengdu, China
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question How to set the decoration hightlighted when select a row in QTreeView

    Hello,

    I want to hightlight the whole row when select it in QTreeView.
    But it seems the decoration (+) never highlighted.
    I want it works like the followed picture. But it isn't the windows style.
    I have try to use: show-decoration-selected: 1; but it's not helpful.
    I also tried setAllColumnsShowFocus ( true ) , also can't work.

    select.PNG

    Can somebody help me about this?

  2. #2
    Join Date
    Feb 2009
    Location
    Chengdu, China
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to set the decoration hightlighted when select a row in QTreeView

    I use delegate to draw the rows.
    In paint function:
    Qt Code:
    1. if( option.state & QStyle::State_Selected )
    2. {
    3. QRect rect( option.rect );
    4. rect.setLeft( 0 );
    5. painter->fillRect( rect, option.palette.highlight() );
    6. }
    To copy to clipboard, switch view to plain text mode 

    For this, all the area can be highlighted. But overwritted decoration can't be shown. Maybe the color of decoration should be changed when selected.

Similar Threads

  1. Select a row from QTreeView
    By vieraci in forum Qt Programming
    Replies: 5
    Last Post: 7th December 2015, 19:44
  2. QTreeView decoration events
    By xwhatsit in forum Qt Programming
    Replies: 0
    Last Post: 10th September 2010, 08:10
  3. QTreeView show-decoration-selected has no effect
    By stefanadelbert in forum Qt Programming
    Replies: 3
    Last Post: 1st July 2010, 23:42
  4. Replies: 1
    Last Post: 10th June 2010, 05:35
  5. QTreeView: make root decoration appear on visual column 0
    By chezifresh in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2008, 02: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.