1 Attachment(s)
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.
Attachment 6629
Can somebody help me about this?
Re: How to set the decoration hightlighted when select a row in QTreeView
I use delegate to draw the rows.
In paint function:
Code:
if( option.
state & QStyle::State_Selected ) {
QRect rect
( option.
rect );
rect.setLeft( 0 );
painter->fillRect( rect, option.palette.highlight() );
}
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.