Skip to content
Permalink
Browse files

[ui] Improve looks of variable editor widget on non-default themes

  • Loading branch information
nirvn authored and nyalldawson committed Jun 13, 2020
1 parent 1f1f163 commit 5b6d3923917130d3998b50a0f89b896958b99ea2
Showing with 7 additions and 14 deletions.
  1. +7 −14 src/gui/qgsvariableeditorwidget.cpp
@@ -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 ) );
@@ -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 );
}
}

0 comments on commit 5b6d392

Please sign in to comment.
You can’t perform that action at this time.