Skip to content

Commit

Permalink
[ui] Improve looks of variable editor widget on non-default themes
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jun 13, 2020
1 parent 11c9009 commit 147d873
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/gui/qgsvariableeditorwidget.cpp
Expand Up @@ -485,16 +485,9 @@ void QgsVariableEditorTree::drawRow( QPainter *painter, const QStyleOptionViewIt
QColor baseColor = item->data( 0, RowBaseColor ).value<QColor>();
if ( index.row() % 2 == 1 )
{
baseColor = baseColor.lighter( 110 );
baseColor.setAlpha( 59 );
}
painter->fillRect( option.rect, baseColor );

//declare custom text color since we've overwritten default background color
QPalette pal = opt.palette;
pal.setColor( QPalette::Active, QPalette::Text, Qt::black );
pal.setColor( QPalette::Inactive, QPalette::Text, Qt::black );
pal.setColor( QPalette::Disabled, QPalette::Text, Qt::gray );
opt.palette = pal;
}
QTreeWidget::drawRow( painter, opt, index );
QColor color = static_cast<QRgb>( QApplication::style()->styleHint( QStyle::SH_Table_GridLineColor, &opt ) );
Expand All @@ -511,18 +504,18 @@ QColor QgsVariableEditorTree::rowColor( int index ) const
switch ( colorIdx )
{
case 0:
return QColor( 255, 220, 167 );
return QColor( 255, 163, 0, 89 );
case 1:
return QColor( 255, 255, 191 );
return QColor( 255, 255, 77, 89 );
case 2:
return QColor( 191, 255, 191 );
return QColor( 0, 255, 77, 89 );
case 3:
return QColor( 199, 255, 255 );
return QColor( 0, 255, 255, 89 );
case 4:
return QColor( 234, 191, 255 );
return QColor( 196, 125, 255, 89 );
case 5:
default:
return QColor( 255, 191, 239 );
return QColor( 255, 125, 225, 89 );
}
}

Expand Down

0 comments on commit 147d873

Please sign in to comment.