Change hover style of ColorPaletteItems.

This commit is contained in:
Jim Evins
2016-03-01 23:27:30 -05:00
parent 89d2602b5b
commit 573369b6da
+9 -21
View File
@@ -81,23 +81,6 @@ namespace glabels
{
QPainter painter(this);
//
// Draw background
//
if ( isEnabled() && mHover )
{
QLinearGradient gradient( 0, 0, 0, height() );
gradient.setColorAt( 0, palette().color( QPalette::Highlight ).lighter() );
gradient.setColorAt( 1, palette().color( QPalette::Highlight ) );
painter.setBrush( QBrush( gradient ) );
QPen pen( palette().color( QPalette::Text ) );
pen.setWidth( hoverBgOutlineWidthPixels );
painter.setPen( pen );
painter.drawRect( 0, 0, width()-1, height()-1 );
}
//
// Draw swatch
//
@@ -105,15 +88,20 @@ namespace glabels
{
if ( mHover )
{
QPen pen( palette().color( QPalette::HighlightedText ) );
pen.setWidth( outlineWidthPixels );
QPen pen( palette().color( QPalette::Text ) );
pen.setWidth( 2*outlineWidthPixels );
pen.setJoinStyle( Qt::MiterJoin );
painter.setPen( pen );
painter.setBrush( QBrush( mColor ) );
painter.drawRect( 1, 1, width()-2, height()-2 );
}
else
{
QPen pen( palette().color( QPalette::Text ) );
pen.setWidth( outlineWidthPixels );
painter.setPen( pen );
painter.setBrush( QBrush( mColor ) );
painter.drawRect( border, border, wSwatch, hSwatch );
}
@@ -123,10 +111,10 @@ namespace glabels
QPen pen( palette().color( QPalette::Disabled, QPalette::Text ) );
pen.setWidth( outlineWidthPixels );
painter.setPen( pen );
painter.setBrush( QBrush( mColor ) );
painter.drawRect( border, border, wSwatch, hSwatch );
}
painter.setBrush( QBrush( mColor ) );
painter.drawRect( border, border, wSwatch, hSwatch );
}