Remove hardcoded colors from color palette dialog -- use current style colors.

This commit is contained in:
Jim Evins
2015-08-19 11:45:03 -04:00
parent e4d2603cb4
commit f27cf4708b
3 changed files with 13 additions and 28 deletions
+6 -11
View File
@@ -32,12 +32,7 @@ namespace
{
const int border = 4;
const int hBox = 25;
const QColor hoverOutlineColor( 89, 130, 182 );
const QColor hoverGradientColor0( 164, 195, 232 );
const QColor hoverGradientColor1( 147, 181, 224 );
const int outlineWidthPixels = 1;
const QColor textColor( 0, 0, 0 );
const QColor hoverTextColor( 255, 255, 255 );
}
@@ -68,11 +63,11 @@ namespace glabels
if ( mHover )
{
QLinearGradient gradient( 0, 0, 0, height() );
gradient.setColorAt( 0, hoverGradientColor0 );
gradient.setColorAt( 1, hoverGradientColor1 );
gradient.setColorAt( 0, palette().color( QPalette::Highlight ).lighter() );
gradient.setColorAt( 1, palette().color( QPalette::Highlight ) );
painter.setBrush( QBrush( gradient ) );
QPen pen( hoverOutlineColor );
QPen pen( palette().color( QPalette::Text ) );
pen.setWidth( outlineWidthPixels );
painter.setPen( pen );
@@ -86,11 +81,11 @@ namespace glabels
if ( mHover )
{
painter.setPen( QPen( hoverTextColor ) );
painter.setPen( QPen( palette().color( QPalette::HighlightedText ) ) );
}
else
{
painter.setPen( QPen( textColor ) );
painter.setPen( QPen( palette().color( QPalette::Text ) ) );
}
QRect textRect( border, border, width()-2*border, hBox );
+1 -3
View File
@@ -26,8 +26,6 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QPushButton>
#include <QToolButton>
#include <QFrame>
@@ -90,7 +88,7 @@ namespace glabels
mDefaultColor = defaultColor;
mColorNode = ColorNode( color );
setStyleSheet( "background: white; border: 1px solid black" );
setStyleSheet( ".glabels--ColorPaletteDialog {background: white; border: 1px solid black}" );
setWindowFlags( Qt::Popup | Qt::FramelessWindowHint );
QVBoxLayout* vLayout = new QVBoxLayout();
+6 -14
View File
@@ -34,14 +34,8 @@ namespace
const int wSwatch = 25;
const int hSwatch = 25;
const QColor hoverBgOutlineColor( 89, 130, 182 );
const QColor hoverBgGradientColor0( 164, 195, 232 );
const QColor hoverBgGradientColor1( 147, 181, 224 );
const int hoverBgOutlineWidthPixels = 1;
const QColor outlineColor( 0, 0, 0 );
const QColor hoverOutlineColor( 255, 255, 255 );
const QColor emptyOutlineColor( 192, 192, 192 );
const int outlineWidthPixels = 1;
}
@@ -93,11 +87,11 @@ namespace glabels
if ( isEnabled() && mHover )
{
QLinearGradient gradient( 0, 0, 0, height() );
gradient.setColorAt( 0, hoverBgGradientColor0 );
gradient.setColorAt( 1, hoverBgGradientColor1 );
gradient.setColorAt( 0, palette().color( QPalette::Highlight ).lighter() );
gradient.setColorAt( 1, palette().color( QPalette::Highlight ) );
painter.setBrush( QBrush( gradient ) );
QPen pen( hoverBgOutlineColor );
QPen pen( palette().color( QPalette::Text ) );
pen.setWidth( hoverBgOutlineWidthPixels );
painter.setPen( pen );
@@ -107,19 +101,17 @@ namespace glabels
//
// Draw swatch
//
painter.setBrush( QBrush( Qt::NoBrush ) );
if ( isEnabled() )
{
if ( mHover )
{
QPen pen( hoverOutlineColor );
QPen pen( palette().color( QPalette::HighlightedText ) );
pen.setWidth( outlineWidthPixels );
painter.setPen( pen );
}
else
{
QPen pen( outlineColor );
QPen pen( palette().color( QPalette::Text ) );
pen.setWidth( outlineWidthPixels );
painter.setPen( pen );
}
@@ -128,7 +120,7 @@ namespace glabels
}
else
{
QPen pen( emptyOutlineColor );
QPen pen( palette().color( QPalette::Disabled, QPalette::Text ) );
pen.setWidth( outlineWidthPixels );
painter.setPen( pen );
}