24 #ifndef KLFCOLORCHOOSER_H
25 #define KLFCOLORCHOOSER_H
27 #include <QPushButton>
29 #include <QApplication>
35 #include <QGridLayout>
51 Q_PROPERTY(
QColor color READ color WRITE setColor USER
true)
61 void colorActivated(
const QColor& color);
63 void wantRemoveColor(
const QColor& color);
69 emit colorActivated(_color);
84 void internalWantRemove();
137 int valueAFromNewColor(
const QColor& color)
const;
139 int valueBFromNewColor(
const QColor& color)
const;
141 inline int valueA()
const {
return valueAFromNewColor(_color); }
143 inline int valueB()
const {
return valueBFromNewColor(_color); }
145 inline int valueAMax()
const {
return valueMax(_colorcomponent); }
147 inline int valueBMax()
const {
return valueMax(_colorcomponent_b); }
165 QColor colorFromValues(
QColor color_base,
int value_a,
int value_b = -1);
172 bool refreshColorFromInternalValues(
int value_a,
int value_b = -1);
176 static int valueFromNewColor(
const QColor& color,
const QString& component);
183 static int valueMax(
const QString& component);
222 Q_PROPERTY(
QString colorComponent READ colorComponent WRITE setColorComponent)
223 Q_PROPERTY(
QColor color READ color WRITE setColor USER true)
232 void colorChanged(
const QColor& color);
235 void setColorComponent(
const QString& component);
236 void setColor(
const QColor& color);
239 void internalChanged(
int newvalue);
267 Q_PROPERTY(
QString paneType READ paneType WRITE setPaneType);
268 Q_PROPERTY(
QColor color READ color WRITE setColor USER
true);
277 void colorChanged(
const QColor& color);
280 void setColor(
const QColor& newcolor);
281 void setPaneType(
const QString& panetype);
318 Q_PROPERTY(
QColor color READ color WRITE setColor USER
true)
319 Q_PROPERTY(
bool alphaEnabled READ alphaEnabled WRITE setAlphaEnabled)
328 static void ensureColorListsInstance();
330 static void addRecentColor(
const QColor& col);
335 void colorChanged(
const QColor& color);
338 void setColor(
const QColor& color);
339 void setAlphaEnabled(
bool alpha_enabled);
340 void setCurrentToCustomColor();
342 void updatePalettes();
344 void updatePaletteRecent();
345 void updatePaletteStandard();
346 void updatePaletteCustom();
349 virtual void internalColorChanged(
const QColor& newcolor);
351 virtual void internalColorNameSet(
const QString& colorname);
355 Ui::KLFColorChooseWidget *u;
401 static QColor getColor(
QColor startwith = Qt::black,
bool alphaenabled =
true,
QWidget *parent = 0);
404 Ui::KLFColorDialog *u;
418 Q_PROPERTY(
QSize showSize READ showSize WRITE setShowSize)
419 Q_PROPERTY(
bool allowDefaultState READ allowDefaultState WRITE setAllowDefaultState)
420 Q_PROPERTY(
QString defaultStateString READ defaultStateString WRITE setDefaultStateString)
421 Q_PROPERTY(
bool autoAddToList READ autoAddToList WRITE setAutoAddToList)
422 Q_PROPERTY(
QColor color READ color WRITE setColor USER true)
423 Q_PROPERTY(
float pixXAlignFactor READ pixXAlignFactor WRITE setPixXAlignFactor)
424 Q_PROPERTY(
float pixYAlignFactor READ pixYAlignFactor WRITE setPixYAlignFactor)
425 Q_PROPERTY(
bool alphaEnabled READ alphaEnabled WRITE setAlphaEnabled)
431 QSize showSize()
const {
return _size; }
446 virtual QSize sizeHint()
const;
450 static void setUserMaxColors(
int maxcolors);
456 void colorChanged(
const QColor& newcolor);
462 void setColor(
const QColor& color);
463 void setAllowDefaultState(
bool allow);
464 void setDefaultStateString(
const QString& str);
469 void setAlphaEnabled(
bool alpha_enabled);
471 void setDefaultColor();
476 void setSenderPropertyColor();
486 bool _allowdefaultstate;
490 float _xalignfactor, _yalignfactor;
501 static QStyle *mReplaceButtonStyle;
503 static int staticUserMaxColors;
505 static void ensureColorListInstance();
void setColor(const QColor &col)
float pixYAlignFactor() const
void setPixYAlignFactor(float yalignfactor)
bool autoAddToList() const
void setPixXAlignFactor(float xalignfactor)
void setAutoAddToList(bool autoadd)
QString defaultStateString() const
A Spin box editing a component of a color.
void setShowSize(const QSize &size)
QString colorComponent() const
Base utility class that stores and calculates specific components of a color that is being edited...
float pixXAlignFactor() const
bool alphaEnabled() const
TRUE if the user can also select opacity (alpha) with this widget.
bool allowDefaultState() const
Allow the "default color" state.
A dialog to let the user select a color.
QString _colorcomponent_b