Color button fixes.

This commit is contained in:
Jim Evins
2015-08-18 14:58:30 -04:00
parent 4ab105e06f
commit 4131bedba5
6 changed files with 14 additions and 4 deletions
+6 -3
View File
@@ -26,8 +26,8 @@
namespace namespace
{ {
const int SWATCH_W = 100; const int SWATCH_W = 24;
const int SWATCH_H = 24; const int SWATCH_H = 24;
} }
@@ -47,6 +47,7 @@ namespace glabels
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) ); setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) );
setText( "" ); setText( "" );
setCheckable( true );
mDialog = new ColorPaletteDialog( defaultLabel, defaultColor, color ); mDialog = new ColorPaletteDialog( defaultLabel, defaultColor, color );
mDialog->setModal( true ); mDialog->setModal( true );
@@ -130,10 +131,12 @@ namespace glabels
void ColorButton::onPaletteDialogChanged( ColorNode colorNode, bool isDefault ) void ColorButton::onPaletteDialogChanged( ColorNode colorNode, bool isDefault )
{ {
setDown( false );
mColorNode = colorNode; mColorNode = colorNode;
mIsDefault = isDefault; mIsDefault = isDefault;
emit colorChanged( colorNode, isDefault ); emit colorChanged();
} }
+1 -1
View File
@@ -49,7 +49,7 @@ namespace glabels
// Signals // Signals
///////////////////////////////// /////////////////////////////////
signals: signals:
void colorChanged( ColorNode colorNode, bool isDefault ); void colorChanged();
///////////////////////////////// /////////////////////////////////
+2
View File
@@ -125,6 +125,8 @@ namespace glabels
QPushButton* mergeFieldButton = new QPushButton( "TODO: Field Button" ); QPushButton* mergeFieldButton = new QPushButton( "TODO: Field Button" );
layout->addWidget( mergeFieldButton, iAbsRow, 0, 1, PALETTE_COLS ); layout->addWidget( mergeFieldButton, iAbsRow, 0, 1, PALETTE_COLS );
setLayout( layout );
loadCustomColorHistory(); loadCustomColorHistory();
} }
+1
View File
@@ -45,6 +45,7 @@ namespace glabels
QWidget* parent ) QWidget* parent )
: QPushButton(parent), mId(id), mColor(color), mTip(tip) : QPushButton(parent), mId(id), mColor(color), mTip(tip)
{ {
setFlat( true );
setIcon( QIcon( ColorSwatch( wSwatch, hSwatch, color ) ) ); setIcon( QIcon( ColorSwatch( wSwatch, hSwatch, color ) ) );
setToolTip( tip ); setToolTip( tip );
+1
View File
@@ -40,6 +40,7 @@ namespace glabels
/// Constructor /// Constructor
/// ///
ColorSwatch::ColorSwatch( int w, int h, const QColor& color ) ColorSwatch::ColorSwatch( int w, int h, const QColor& color )
: QPixmap( w, h )
{ {
fill( Qt::transparent ); fill( Qt::transparent );
+3
View File
@@ -39,6 +39,9 @@ namespace glabels
{ {
setupUi( this ); setupUi( this );
lineColorButton->init( "No line", QColor(0,0,0,0), QColor(0,0,0,255) );
fillColorButton->init( "No fill", QColor(0,0,0,0), QColor(0,0,0,255) );
setEnabled( false ); setEnabled( false );
hidePages(); hidePages();
} }