Only draw background if it's parent of current item, hopefully makes the
iconview in tree-mode littlebit cleaner in UI-wise (well, actually want to
see what others like it in this way). Also should make easier/faster to spot
the current items parent from iconview mode in tree-mode.
Also draw background-rect with rounded corners.
Feel free to revert/worship/point fingers/express opinions on this commit.
//Draw children indicator
if( !index.data( PLModel::IsLeafNodeRole ).toBool() )
{
//Draw children indicator
if( !index.data( PLModel::IsLeafNodeRole ).toBool() )
{
- painter->setOpacity( 0.75 );
QRect r( option.rect );
r.setSize( QSize( 25, 25 ) );
r.translate( 5, 5 );
if( index.data( PLModel::IsCurrentsParentNodeRole ).toBool() )
QRect r( option.rect );
r.setSize( QSize( 25, 25 ) );
r.translate( 5, 5 );
if( index.data( PLModel::IsCurrentsParentNodeRole ).toBool() )
- painter->fillRect( r, option.palette.color( QPalette::Highlight ) );
- else
- painter->fillRect( r, option.palette.color( QPalette::Mid ) );
- painter->setOpacity( 1.0 );
+ {
+ painter->setOpacity( 0.75 );
+ QPainterPath nodeRectPath;
+ nodeRectPath.addRoundedRect( r, 4, 4 );
+ painter->fillPath( nodeRectPath, option.palette.color( QPalette::Highlight ) );
+ painter->setOpacity( 1.0 );
+ }
QPixmap dirPix( ":/type/node" );
QRect r2( dirPix.rect() );
r2.moveCenter( r.center() );
QPixmap dirPix( ":/type/node" );
QRect r2( dirPix.rect() );
r2.moveCenter( r.center() );