|
Krita Source Code Documentation
|
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displayed inside. More...
#include <kis_slider_spin_box.h>
Inheritance diagram for KisSliderSpinBox:Signals | |
| void | draggingFinished () |
Signals inherited from KisIntParseSpinBox | |
| void | errorWhileParsing (const QString &expr) const |
| signal emitted when the last parsed expression is not valid. | |
| void | noMoreParsingError () const |
| signal emitted when the last parsed expression is valid and the expression before was not valid. | |
Public Member Functions | |
| int | fastSliderStep () const |
| Get the value to which multiples the sinbox value snaps when the control key is pressed. | |
| bool | isDragging () const |
| Get if the user is currently dragging the slider with the pointer. | |
| KisSliderSpinBox (QWidget *parent=nullptr) | |
| QSize | minimumSizeHint () const override |
| void | setBlockUpdateSignalOnDrag (bool newBlockUpdateSignalOnDrag) |
| Set if the spinbox should not Q_EMIT signals when dragging the slider. | |
| void | setExponentRatio (qreal newExponentRatio) |
| Set the exponent used by a power function to modify the values as a function of the horizontal position. | |
| void | setFastSliderStep (int newFastSliderStep) |
| Set the value to which multiples the sinbox value snaps when the control key is pressed. | |
| void | setMaximum (int newMaximum, bool computeNewFastSliderStep=true) |
| Set the maximum value of the range. | |
| void | setMinimum (int newMinimum, bool computeNewFastSliderStep=true) |
| Set the minimum value of the range. | |
| void | setPageStep (int newPageStep) |
| Does nothing currently. | |
| void | setRange (int newMinimum, int newMaximum, bool computeNewFastSliderStep=true) |
| Set the minimum and the maximum values of the range, computing a new "fast slider step" based on the range if required. | |
| void | setSoftMaximum (int newSoftMaximum) |
| Set the maximum value of the soft range. | |
| void | setSoftMinimum (int newSoftMinimum) |
| Set the minimum value of the soft range. | |
| void | setSoftRange (int newSoftMinimum, int newSoftMaximum) |
| Set the minimum and the maximum values of the soft range. | |
| void | setValue (int newValue) |
| QSize | sizeHint () const override |
| Set the value. | |
| int | softMaximum () const |
| Get the maximum value of the "soft range". | |
| int | softMinimum () const |
| Get the minimum value of the "soft range". | |
| ~KisSliderSpinBox () override | |
Public Member Functions inherited from KisIntParseSpinBox | |
| bool | isLastValid () const |
| Get if the last expression entered is a valid one. | |
| KisIntParseSpinBox (QWidget *parent=0) | |
| void | setValue (int value, bool overwriteExpression=false) |
| Set the value of the spinbox. | |
| void | stepBy (int steps) override |
| This is a reimplementation of QSpinBox::stepBy that uses setValue. | |
| virtual QString | veryCleanText () const |
| This virtual function is similar to cleanText(). But child classes may reimplement it to further process ("clean up") the expression. | |
| ~KisIntParseSpinBox () override | |
Protected Member Functions | |
| virtual void | setInternalValue (int value, bool blockUpdateSignal) |
| void | setPrivateValue (int value) |
Protected Member Functions inherited from KisIntParseSpinBox | |
| QString | textFromValue (int value) const override |
| QValidator::State | validate (QString &input, int &pos) const override |
| int | valueFromText (const QString &text) const override |
Private Attributes | |
| QScopedPointer< KisSliderSpinBoxPrivate< KisSliderSpinBox, KisIntParseSpinBox > > | d |
Friends | |
| template<typename SpinBoxTypeTP , typename BaseSpinBoxTypeTP > | |
| class | KisSliderSpinBoxPrivate |
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displayed inside.
The value can be set by click and dragging with the mouse or pen or by typing in with the keyboard. To enter the edit mode, in which the keyboard can be used, one has to right-click inside the spinbox or double-click the pointer inside or press the enter key. To leave the edit mode, one can press the enter key again, in which case the value is committed, or press the escape key, in which case the value is rejected.
When dragging with the pointer, one can fine tune the value by dragging far away vertically from the spinbox. The farther the pointer is, the slower the value will change. If the pointer is inside the spinbox plus a certain margin, the value will not be scaled. By pressing the shift key the slow down will be even more pronounced and by pressing the control key the value will snap to the increment set by setFastSliderStep. The two keys can be used at the same time.
A "soft range" can be set to make the slider display only a sub-range of the spinbox range. This way one can have a large range but display and set with the pointer and with more precision only the most commonly used sub-set of values. A value outside the "soft range" can be set by entering the edit mode and using the keyboard. The "soft range" is considered valid if the "soft maximum" is greater than the "soft minimum".
Definition at line 50 of file kis_slider_spin_box.h.
| KisSliderSpinBox::KisSliderSpinBox | ( | QWidget * | parent = nullptr | ) |
Definition at line 14 of file kis_slider_spin_box.cpp.
|
override |
Definition at line 19 of file kis_slider_spin_box.cpp.
|
signal |
| int KisSliderSpinBox::fastSliderStep | ( | ) | const |
Get the value to which multiples the sinbox value snaps when the control key is pressed.
Definition at line 22 of file kis_slider_spin_box.cpp.
References d.
| bool KisSliderSpinBox::isDragging | ( | ) | const |
Get if the user is currently dragging the slider with the pointer.
Definition at line 37 of file kis_slider_spin_box.cpp.
References d.
|
override |
Definition at line 47 of file kis_slider_spin_box.cpp.
References d.
| void KisSliderSpinBox::setBlockUpdateSignalOnDrag | ( | bool | newBlockUpdateSignalOnDrag | ) |
Set if the spinbox should not Q_EMIT signals when dragging the slider.
This is useful to prevent multiple updates when changing the value if the update operation is costly. A valueChanged signal will be emitted when the pointer is released from the slider.
| newBlockUpdateSignalOnDrag | true if the spinbox should not emit signals when dragging the slider. false otherwise |
Definition at line 77 of file kis_slider_spin_box.cpp.
References d.
| void KisSliderSpinBox::setExponentRatio | ( | qreal | newExponentRatio | ) |
Set the exponent used by a power function to modify the values as a function of the horizontal position.
This allows having more values concentrated in one side of the slider than the other
| newExponentRatio | the new exponent to be used by the power function |
Definition at line 72 of file kis_slider_spin_box.cpp.
References d.
| void KisSliderSpinBox::setFastSliderStep | ( | int | newFastSliderStep | ) |
Set the value to which multiples the sinbox value snaps when the control key is pressed.
| newFastSliderStep | value to which multiples the spinbox value snaps when the control key is pressed |
Definition at line 82 of file kis_slider_spin_box.cpp.
References d.
|
protectedvirtual |
Definition at line 107 of file kis_slider_spin_box.cpp.
References d.
| void KisSliderSpinBox::setMaximum | ( | int | newMaximum, |
| bool | computeNewFastSliderStep = true ) |
Set the maximum value of the range.
The soft range will be adapted to fit inside the range
| newMaximum | the new maximum value |
| computeNewFastSliderStep | true if a new "fast slider step" must be computed based on the range |
Definition at line 67 of file kis_slider_spin_box.cpp.
References setRange().
| void KisSliderSpinBox::setMinimum | ( | int | newMinimum, |
| bool | computeNewFastSliderStep = true ) |
Set the minimum value of the range.
The soft range will be adapted to fit inside the range
| newMinimum | the new minimum value |
| computeNewFastSliderStep | true if a new "fast slider step" must be computed based on the range |
Definition at line 62 of file kis_slider_spin_box.cpp.
References setRange().
| void KisSliderSpinBox::setPageStep | ( | int | newPageStep | ) |
|
protected |
Definition at line 112 of file kis_slider_spin_box.cpp.
References setValue().
| void KisSliderSpinBox::setRange | ( | int | newMinimum, |
| int | newMaximum, | ||
| bool | computeNewFastSliderStep = true ) |
Set the minimum and the maximum values of the range, computing a new "fast slider step" based on the range if required.
The soft range will be adapted to fit inside the range
| newMinimum | the new minimum value |
| newMaximum | the new maximum value |
| computeNewFastSliderStep | true if a new "fast slider step" must be computed based on the range |
Definition at line 57 of file kis_slider_spin_box.cpp.
References d.
| void KisSliderSpinBox::setSoftMaximum | ( | int | newSoftMaximum | ) |
Set the maximum value of the soft range.
| newSoftMaximum | the new maximum value |
Definition at line 102 of file kis_slider_spin_box.cpp.
References d, and setSoftRange().
| void KisSliderSpinBox::setSoftMinimum | ( | int | newSoftMinimum | ) |
Set the minimum value of the soft range.
| newSoftMinimum | the new minimum value |
Definition at line 97 of file kis_slider_spin_box.cpp.
References d, and setSoftRange().
| void KisSliderSpinBox::setSoftRange | ( | int | newSoftMinimum, |
| int | newSoftMaximum ) |
Set the minimum and the maximum values of the soft range.
| newSoftMinimum | the new minimum value |
| newSoftMaximum | the new maximum value |
Definition at line 92 of file kis_slider_spin_box.cpp.
References d.
| void KisSliderSpinBox::setValue | ( | int | newValue | ) |
Definition at line 52 of file kis_slider_spin_box.cpp.
References d.
|
override |
Set the value.
| newValue | the new value |
Definition at line 42 of file kis_slider_spin_box.cpp.
References d.
| int KisSliderSpinBox::softMaximum | ( | ) | const |
Get the maximum value of the "soft range".
Definition at line 32 of file kis_slider_spin_box.cpp.
References d.
| int KisSliderSpinBox::softMinimum | ( | ) | const |
Get the minimum value of the "soft range".
Definition at line 27 of file kis_slider_spin_box.cpp.
References d.
|
friend |
Definition at line 201 of file kis_slider_spin_box.h.
|
private |
Definition at line 202 of file kis_slider_spin_box.h.