JKQtExtras
a library of useful Qt widgets and tools
|
a QSlider that allows to choose a color hue More...
#include <jkqtecolorslider.h>
Public Types | |
enum | IndicatorStyle { FixedColorDoubleArrowIndicator =0, FixedColorCircleIndicator, SelectedColorDoubleArrowIndicator, SelectedColorCircleIndicator } |
available modes for the slider More... | |
enum | SliderMode { GreySlider =0, GraySlider =GreySlider, RedSlider, GreenSlider, BlueSlider, HueSlider, SaturationSlider, ValueSlider, TransparencySlider, AlphaSlider =TransparencySlider } |
available modes for the slider More... | |
Public Slots | |
void | setBaseColor (QColor baseColor) |
sets the currently set base color that is modified by the slider More... | |
void | setSliderMode (SliderMode mode) |
sets the currently set color/slider mode More... | |
Signals | |
void | colorChanged (QColor color) |
emitted when the slider moves, the color is based on the baseColor(), modified by the slider value More... | |
Public Member Functions | |
JKQTEColorSlider (Qt::Orientation orientation, QWidget *parent=nullptr) | |
JKQTEColorSlider (QWidget *parent=nullptr) | |
JKQTEColorSlider (SliderMode mode, Qt::Orientation orientation, QWidget *parent=nullptr) | |
JKQTEColorSlider (SliderMode mode, QWidget *parent=nullptr) | |
QColor | baseColor () const |
returns the currently set base color that is modified by the slider More... | |
QBrush & | indicatorBrush () |
returns the QBrush used to draw the indicator More... | |
const QBrush & | indicatorBrush () const |
returns the QBrush used to draw the indicator More... | |
QPen & | indicatorPen () |
returns the QPen used to draw the indicator More... | |
const QPen & | indicatorPen () const |
returns the QPen used to draw the indicator More... | |
IndicatorStyle | indicatorStyle () const |
style of the indicator More... | |
virtual QSize | minimumSizeHint () const override |
QColor | modifiedColor () const |
takes the color baseColor() and applies the value of the slider to the color More... | |
QColor | modifiedColor (QColor colorIn) const |
takes the color colorIn and applies the value of the slider to the color More... | |
void | setIndicatorBrush (const QBrush &b) |
sets the QBrush used to draw the indicator More... | |
void | setIndicatorPen (const QPen &p) |
sets the QPen used to draw the indicator More... | |
void | setIndicatorStyle (IndicatorStyle s) |
sets the style of the indicator More... | |
virtual QSize | sizeHint () const override |
SliderMode | sliderMode () const |
returns the currently set color/slider mode More... | |
Protected Slots | |
void | baseSliderChanged (int value) |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *ev) override |
paints the slider More... | |
Static Protected Member Functions | |
static QColor | defaultBaseColor (SliderMode mode) |
returns the default base color for a given slider mode More... | |
Protected Attributes | |
QColor | m_baseColor |
currently set base color that is modified by the slider More... | |
QBrush | m_indicatorBrush |
QBrush used to draw the indicator More... | |
QPen | m_indicatorPen |
QPen used to draw the indicator More... | |
IndicatorStyle | m_indicatorStyle |
style of the indicator More... | |
SliderMode | m_mode |
currently set color/slider mode More... | |
Properties | |
QColor | baseColor |
QBrush | indicatorBrush |
QPen | indicatorPen |
IndicatorStyle | IndicatorStyle |
SliderMode | sliderMode |
a QSlider that allows to choose a color hue
Horizontal Hue-Slider:
Vertical Hue Slider:
Basic usage is simple:
Especially when building a color-chooser, you need to combine several sliders. That then define a color together. To support such modes, the slider can use a "base color" i.e. an input color which is then modified and output again. The following functions support this mode:
Here is an example of how to use this feature:
available modes for the slider
the appearance and the range of the slider depend on this
Enumerator | |
---|---|
FixedColorDoubleArrowIndicator | draws two inward pointing triangles as indicator, filled with indicatorBrush() ![]() |
FixedColorCircleIndicator | draws a circle as indicator, filled with indicatorBrush() ![]() |
SelectedColorDoubleArrowIndicator | draws two inward pointing triangles as indicator, filled with the current color ![]() |
SelectedColorCircleIndicator | draws a circle as indicator, filled with the current color ![]() |
available modes for the slider
the appearance and the range of the slider depend on this
|
explicit |
|
explicit |
|
explicit |
|
explicit |
QColor JKQTEColorSlider::baseColor | ( | ) | const |
returns the currently set base color that is modified by the slider
|
protectedslot |
|
signal |
emitted when the slider moves, the color is based on the baseColor(), modified by the slider value
|
staticprotected |
returns the default base color for a given slider mode
QBrush& JKQTEColorSlider::indicatorBrush | ( | ) |
returns the QBrush used to draw the indicator
const QBrush& JKQTEColorSlider::indicatorBrush | ( | ) | const |
returns the QBrush used to draw the indicator
QPen& JKQTEColorSlider::indicatorPen | ( | ) |
returns the QPen used to draw the indicator
const QPen& JKQTEColorSlider::indicatorPen | ( | ) | const |
returns the QPen used to draw the indicator
IndicatorStyle JKQTEColorSlider::indicatorStyle | ( | ) | const |
style of the indicator
|
overridevirtual |
QColor JKQTEColorSlider::modifiedColor | ( | ) | const |
takes the color baseColor() and applies the value of the slider to the color
QColor JKQTEColorSlider::modifiedColor | ( | QColor | colorIn | ) | const |
takes the color colorIn and applies the value of the slider to the color
|
overrideprotectedvirtual |
paints the slider
|
slot |
sets the currently set base color that is modified by the slider
void JKQTEColorSlider::setIndicatorBrush | ( | const QBrush & | b | ) |
sets the QBrush used to draw the indicator
void JKQTEColorSlider::setIndicatorPen | ( | const QPen & | p | ) |
sets the QPen used to draw the indicator
void JKQTEColorSlider::setIndicatorStyle | ( | IndicatorStyle | s | ) |
sets the style of the indicator
|
slot |
sets the currently set color/slider mode
The appearance and the range of the slider depend on this
|
overridevirtual |
SliderMode JKQTEColorSlider::sliderMode | ( | ) | const |
returns the currently set color/slider mode
The appearance and the range of the slider depend on this
|
protected |
currently set base color that is modified by the slider
|
protected |
QBrush used to draw the indicator
|
protected |
QPen used to draw the indicator
|
protected |
style of the indicator
|
protected |
currently set color/slider mode
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |