Skip to content
Permalink
Browse files

Merge pull request #2334 from nirvn/welcome_page_style_v2

[welcome page] set normal & highlight text color for theme compatibility
  • Loading branch information
m-kuhn committed Sep 23, 2015
2 parents 6a6adc9 + 055d968 commit 33cddb8b2de335360184b9dedfbb7e1896a85073
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/app/qgswelcomepageitemsmodel.cpp
@@ -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 ) );

0 comments on commit 33cddb8

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