A Spin box editing a component of a color. More...
#include <klfcolorchooser.h>
Public Slots | |
void | setColorComponent (const QString &component) |
void | setColor (const QColor &color) |
Signals | |
void | colorChanged (const QColor &color) |
Public Member Functions | |
KLFColorComponentSpinBox (QWidget *parent) | |
virtual | ~KLFColorComponentSpinBox () |
QString | colorComponent () const |
QColor | color () const |
![]() | |
QSpinBox (QWidget *parent=0) | |
setRange (int minimum, int maximum) | |
textFromValue (int value) | |
valueChanged (int i) | |
valueChanged (const QString &text) | |
valueFromText (const QString &text) | |
QSpinBox (QWidget *parent, const char *name) | |
QSpinBox (int minimum, int maximum, int step, QWidget *parent, const char *name=0) | |
maxValue () | |
minValue () | |
setLineStep (int step) | |
setMaxValue (int value) | |
setMinValue (int value) | |
clear () | |
Additional Inherited Members | |
![]() | |
int | valueAFromNewColor (const QColor &color) const |
int | valueBFromNewColor (const QColor &color) const |
int | valueA () const |
int | valueB () const |
int | valueAMax () const |
int | valueBMax () const |
QColor | colorFromValues (QColor color_base, int value_a, int value_b=-1) |
bool | refreshColorFromInternalValues (int value_a, int value_b=-1) |
![]() | |
static int | valueFromNewColor (const QColor &color, const QString &component) |
static int | valueMax (const QString &component) |
![]() | |
QColor | _color |
QString | _colorcomponent |
QString | _colorcomponent_b |
A Spin box editing a component of a color.
the color component is given as a string, one of those listed in documentation for KLFColorComponentsEditorBase.
Use setColorComponent() to set the component, then use setColor() to set a color, and connect to colorChanged() for changes by the user to this component, and retrieve the color with color(). color() returns the color that was set with setColor(), except that the compoenent being edited was adjusted to the currently edited value.
You can retrieve the value of the component being edited with the value() member (inherited from QSpinBox).
Example usage is to have multiple instances of this spin box editing different components, with a chain (looped) of colorChanged() signals connected to the setColor() of the next spin box in such way as to have all spin boxes being up to date. With this trick you can edit components that are not independant (eg. saturation and red values; they need to update each other when edited).
See KLFColorChooseWidget for an example.
Definition at line 218 of file klfcolorchooser.h.
KLFColorComponentSpinBox::KLFColorComponentSpinBox | ( | QWidget * | parent | ) |
Definition at line 373 of file klfcolorchooser.cpp.
References KLFColorComponentsEditorBase::_color, setColor(), setColorComponent(), KLFColorComponentsEditorBase::valueAFromNewColor(), and QSpinBox::valueChanged().
|
inlinevirtual |
Definition at line 226 of file klfcolorchooser.h.
|
inline |
Definition at line 229 of file klfcolorchooser.h.
References KLFColorComponentsEditorBase::_color.
Referenced by setColor().
|
signal |
|
inline |
Definition at line 228 of file klfcolorchooser.h.
References KLFColorComponentsEditorBase::_colorcomponent.
|
slot |
Definition at line 399 of file klfcolorchooser.cpp.
References KLFColorComponentsEditorBase::_color, color(), and KLFColorComponentsEditorBase::valueAFromNewColor().
Referenced by KLFColorComponentSpinBox().
|
slot |
Definition at line 386 of file klfcolorchooser.cpp.
References KLFColorComponentsEditorBase::_colorcomponent, QString::toLower(), and KLFColorComponentsEditorBase::valueAMax().
Referenced by KLFColorComponentSpinBox().