From 573369b6da9af42f81d0c25ea8c9ea90a365066b Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Tue, 1 Mar 2016 23:27:30 -0500 Subject: [PATCH] Change hover style of ColorPaletteItems. --- glabels/ColorPaletteItem.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/glabels/ColorPaletteItem.cpp b/glabels/ColorPaletteItem.cpp index 23a8ccb..7691d3d 100644 --- a/glabels/ColorPaletteItem.cpp +++ b/glabels/ColorPaletteItem.cpp @@ -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 ); }