Class SliderSpinBox
Build from SliderSpinBox.h
Krita master

This class is a wrapper around KisSliderSpinBox, a spinbox in which

you can click and drag to set the value, with a slider like bar displayed inside. The widget itself is accessed with the widget() function.

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 click and hold 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".

Methods

fastSliderStep()int isDragging()bool setBlockUpdateSignalOnDrag(newBlockUpdateSignalOnDrag: bool) setExponentRatio(newExponentRatio: float) setFastSliderStep(newFastSliderStep: int) setMaximum(newMaximum: int, computeNewFastSliderStep: bool = True) setMinimum(newMinimum: int, computeNewFastSliderStep: bool = True) setRange(newMinimum: int, newMaximum: int, computeNewFastSliderStep: bool = True) setSoftMaximum(newSoftMaximum: int) setSoftMinimum(newSoftMinimum: int) setSoftRange(newSoftMinimum: int, newSoftMaximum: int) setValue(newValue: int) softMaximum()int softMinimum()int widget()QWidget

Signals

draggingFinished()

Member documentation

Krita master
fastSliderStep()int
Krita master

Get the value to which multiples the spinbox value snaps when the control key is pressed

Return

the value to which multiples the spinbox value snaps when the control key is pressed

isDragging()bool
Krita master

Get if the user is currently dragging the slider with the pointer

Return

true if the user is currently dragging the slider with the pointer, false otherwise

setBlockUpdateSignalOnDrag(newBlockUpdateSignalOnDrag: bool)
Krita master

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.

Parameters

newBlockUpdateSignalOnDrag

true if the spinbox should not emit signals when dragging the slider. false otherwise

setExponentRatio(newExponentRatio: float)
Krita master

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

Parameters

newExponentRatio

the new exponent to be used by the power function

setFastSliderStep(newFastSliderStep: int)
Krita master

Set the value to which multiples the spinbox value snaps when the control key is pressed

Parameters

newFastSliderStep

value to which multiples the spinbox value snaps when the control key is pressed

setMaximum(newMaximum: int, computeNewFastSliderStep: bool = True)
Krita master

Set the maximum value of the range

The soft range will be adapted to fit inside the range

Parameters

newMaximum

the new maximum value

computeNewFastSliderStep

true if a new "fast slider step" must be computed based on the range

🢒 See setMinimum()
setMinimum(newMinimum: int, computeNewFastSliderStep: bool = True)
Krita master

Set the minimum value of the range

The soft range will be adapted to fit inside the range

Parameters

newMinimum

the new minimum value

computeNewFastSliderStep

true if a new "fast slider step" must be computed based on the range

🢒 See setMaximum()
setRange(newMinimum: int, newMaximum: int, computeNewFastSliderStep: bool = True)
Krita master

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

Parameters

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

🢒 See setMaximum()
setSoftMaximum(newSoftMaximum: int)
Krita master

Set the maximum value of the soft range

Parameters

newSoftMaximum

the new maximum value

setSoftMinimum(newSoftMinimum: int)
Krita master

Set the minimum value of the soft range

Parameters

newSoftMinimum

the new minimum value

setSoftRange(newSoftMinimum: int, newSoftMaximum: int)
Krita master

Set the minimum and the maximum values of the soft range

Parameters

newSoftMinimum

the new minimum value

newSoftMaximum

the new maximum value

setValue(newValue: int)
Krita master

Set the value

Parameters

newValue

the new value

softMaximum()int
Krita master

Get the maximum value of the "soft range"

Return

the maximum value of the "soft range"

softMinimum()int
Krita master

Get the minimum value of the "soft range"

Return

the minimum value of the "soft range"

widget()QWidget
Krita master

Get the internal KisSliderSpinBox as a QWidget, so it may be added to a UI

Return

the internal KisSliderSpinBox as a QWidget