23 #include "colorbutton.h"
24 #include <QColorDialog>
26 ColorButton::ColorButton(QWidget* parent)
29 connect(
this, SIGNAL( clicked() ),
this, SLOT( thisClicked() ) );
31 color.setNamedColor(
"#ffffff");
35 QString ColorButton::colorHtml()
const
40 unsigned ColorButton::colorUnsigned()
const
45 void ColorButton::setColor(
unsigned colorValue)
48 newColor.setRgb(colorValue);
52 void ColorButton::setColorHtml(
const QString& colorHtml)
55 newColor.setNamedColor(colorHtml);
59 void ColorButton::thisClicked()
61 QColor colorTmp = QColorDialog::getColor(QColor(color), parentWidget());
63 if(colorTmp.isValid())
69 void ColorButton::updateAppearance()
71 static const QString COLOR_STYLE =
"QPushButton { background-color : %1; }";
73 QString styleSheet = COLOR_STYLE.arg(color.name());
74 setStyleSheet(styleSheet);
79 QColor oldColor = color;
83 emit colorUpdated(oldColor, color);