Skip to content

Commit

Permalink
Merge pull request #2334 from nirvn/welcome_page_style_v2
Browse files Browse the repository at this point in the history
[welcome page] set normal & highlight text color for theme compatibility
  • Loading branch information
m-kuhn committed Sep 23, 2015
2 parents 6a6adc9 + 055d968 commit 33cddb8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/app/qgswelcomepageitemsmodel.cpp
Expand Up @@ -37,24 +37,28 @@ void QgsWelcomePageItemDelegate::paint( QPainter* painter, const QStyleOptionVie

QTextDocument doc;
QAbstractTextDocumentLayout::PaintContext ctx;
QStyleOptionViewItemV4 optionV4 = option;

QColor color;
if ( option.state & QStyle::State_Selected )
if ( option.state & QStyle::State_Selected && option.state & QStyle::State_HasFocus )
{
color = QColor( 255, 255, 255, 60 );
QStyle *style = QApplication::style();
style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, NULL );
ctx.palette.setColor( QPalette::Text, optionV4.palette.color( QPalette::Active, QPalette::HighlightedText ) );
}
else if ( option.state & QStyle::State_Enabled )
{
color = QColor( 100, 100, 100, 30 );
ctx.palette.setColor( QPalette::Text, optionV4.palette.color( QPalette::Active, QPalette::Text ) );
}
else
{
color = QColor( 100, 100, 100, 30 );
ctx.palette.setColor( QPalette::Text, QColor( 150, 150, 150, 255 ) );
ctx.palette.setColor( QPalette::Text, optionV4.palette.color( QPalette::Disabled, QPalette::Text ) );
}

QStyle *style = QApplication::style();
style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, NULL );

painter->setRenderHint( QPainter::Antialiasing );
painter->setPen( QColor( 0, 0, 0, 0 ) );
painter->setBrush( QBrush( color ) );
Expand Down

0 comments on commit 33cddb8

Please sign in to comment.