RangeSlider
RangeSlider
#include <rangeslider.h>
Inherits from QSlider
Public Types
Name | |
---|---|
typedef QSlider | Superclass |
Public Slots
Name | |
---|---|
void | setMinimumValue(int min) |
void | setMaximumValue(int max) |
void | setValues(int min, int max) |
Protected Slots
Name | |
---|---|
void | onRangeChanged(int minimum, int maximum) |
Public Signals
Name | |
---|---|
void | minimumValueChanged(int min) |
void | maximumValueChanged(int max) |
void | valuesChanged(int min, int max) Utility signal that is fired when minimum or maximum values have changed. |
void | minimumPositionChanged(int min) |
void | maximumPositionChanged(int max) |
void | positionsChanged(int min, int max) |
Public Functions
Name | |
---|---|
RangeSlider(Qt::Orientation o, QWidget * par =nullptr) | |
RangeSlider(QWidget * par =nullptr) | |
virtual | ~RangeSlider() |
int | minimumValue() const |
int | maximumValue() const |
int | minimumPosition() const |
void | setMinimumPosition(int min) |
int | maximumPosition() const |
void | setMaximumPosition(int max) |
void | setPositions(int min, int max) |
bool | symmetricMoves() const |
void | setSymmetricMoves(bool symmetry) |
QString | handleToolTip() const |
void | setHandleToolTip(const QString & toolTip) |
bool | isMinimumSliderDown() const |
bool | isMaximumSliderDown() const |
Protected Functions
Name | |
---|---|
RangeSlider(RangeSliderPrivate * impl, Qt::Orientation o, QWidget * par =nullptr) | |
RangeSlider(RangeSliderPrivate * impl, QWidget * par =nullptr) | |
virtual void | mousePressEvent(QMouseEvent * ev) override |
virtual void | mouseMoveEvent(QMouseEvent * ev) override |
virtual void | mouseReleaseEvent(QMouseEvent * ev) override |
virtual void | paintEvent(QPaintEvent * ev) override |
virtual void | initMinimumSliderStyleOption(QStyleOptionSlider * option) const |
virtual void | initMaximumSliderStyleOption(QStyleOptionSlider * option) const |
virtual bool | event(QEvent * event) override |
Public Properties
Name | |
---|---|
int | minimumValue |
int | maximumValue |
int | minimumPosition |
int | maximumPosition |
bool | symmetricMoves |
QString | handleToolTip |
Protected Attributes
Name | |
---|---|
QScopedPointer< RangeSliderPrivate > | d_ptr |
Detailed Description
class RangeSlider;
See: ctkDoubleRangeSlider, ctkDoubleSlider, ctkRangeWidget
A RangeSlider is a slider that lets you input 2 values instead of one (see QSlider). These values are typically a lower and upper bound. Values are comprised between the range of the slider. See setRange(), minimum() and maximum(). The upper bound can’t be smaller than the lower bound and vice-versa. When setting new values (setMinimumValue(), setMaximumValue() or setValues()), make sure they lie between the range (minimum(), maximum()) of the slider, they would be forced otherwised. If it is not the behavior you desire, you can set the range first (setRange(), setMinimum(), setMaximum()) TODO: support triggerAction(QAbstractSlider::SliderSingleStepSub) that moves both values at a time.
Public Types Documentation
typedef Superclass
typedef QSlider RangeSlider::Superclass;
Public Slots Documentation
slot setMinimumValue
void setMinimumValue(
int min
)
See: stMaximumValue, setValues, setMinimum, setMaximum, setRange
This property holds the slider’s current minimum value. The slider silently forces min to be within the legal range: minimum() <= min <= maximumValue() <= maximum(). Note: Changing the minimumValue also changes the minimumPosition.
slot setMaximumValue
void setMaximumValue(
int max
)
See: stMinimumValue, setValues, setMinimum, setMaximum, setRange
This property holds the slider’s current maximum value. The slider silently forces max to be within the legal range: minimum() <= minimumValue() <= max <= maximum(). Note: Changing the maximumValue also changes the maximumPosition.
slot setValues
void setValues(
int min,
int max
)
See: setMinimumValue, setMaximumValue, setMinimum, setMaximum, setRange
Utility function that set the minimum value and maximum value at once. The slider silently forces min and max to be within the legal range: minimum() <= min <= max <= maximum(). Note: Changing the minimumValue and maximumValue also changes the minimumPosition and maximumPosition.
Protected Slots Documentation
slot onRangeChanged
void onRangeChanged(
int minimum,
int maximum
)
Public Signals Documentation
signal minimumValueChanged
void minimumValueChanged(
int min
)
This signal is emitted when the slider minimum value has changed, with the new slider value as argument.
signal maximumValueChanged
void maximumValueChanged(
int max
)
This signal is emitted when the slider maximum value has changed, with the new slider value as argument.
signal valuesChanged
void valuesChanged(
int min,
int max
)
Utility signal that is fired when minimum or maximum values have changed.
signal minimumPositionChanged
void minimumPositionChanged(
int min
)
This signal is emitted when sliderDown is true and the slider moves. This usually happens when the user is dragging the minimum slider. The value is the new slider minimum position. This signal is emitted even when tracking is turned off.
signal maximumPositionChanged
void maximumPositionChanged(
int max
)
This signal is emitted when sliderDown is true and the slider moves. This usually happens when the user is dragging the maximum slider. The value is the new slider maximum position. This signal is emitted even when tracking is turned off.
signal positionsChanged
void positionsChanged(
int min,
int max
)
Utility signal that is fired when minimum or maximum positions have changed.
Public Functions Documentation
function RangeSlider
explicit RangeSlider(
Qt::Orientation o,
QWidget * par =nullptr
)
Constructor, builds a RangeSlider that ranges from 0 to 100 and has a lower and upper values of 0 and 100 respectively, other properties are set the QSlider default properties.
function RangeSlider
explicit RangeSlider(
QWidget * par =nullptr
)
function ~RangeSlider
virtual ~RangeSlider()
function minimumValue
int minimumValue() const
This property holds the slider’s current minimum value. The slider silently forces minimumValue to be within the legal range: minimum() <= minimumValue() <= maximumValue() <= maximum(). Changing the minimumValue also changes the minimumPosition.
function maximumValue
int maximumValue() const
This property holds the slider’s current maximum value. The slider forces the maximum value to be within the legal range: The slider silently forces maximumValue to be within the legal range: Changing the maximumValue also changes the maximumPosition.
function minimumPosition
int minimumPosition() const
This property holds the current slider minimum position. If tracking is enabled (the default), this is identical to minimumValue.
function setMinimumPosition
void setMinimumPosition(
int min
)
function maximumPosition
int maximumPosition() const
This property holds the current slider maximum position. If tracking is enabled (the default), this is identical to maximumValue.
function setMaximumPosition
void setMaximumPosition(
int max
)
function setPositions
void setPositions(
int min,
int max
)
Utility function that set the minimum position and maximum position at once.
function symmetricMoves
bool symmetricMoves() const
When symmetricMoves is true, moving a handle will move the other handle symmetrically, otherwise the handles are independent. False by default
function setSymmetricMoves
void setSymmetricMoves(
bool symmetry
)
function handleToolTip
QString handleToolTip() const
Controls the text to display for the handle tooltip. It is in addition to the widget tooltip. “%1” is replaced by the current value of the slider. Empty string (by default) means no tooltip.
function setHandleToolTip
void setHandleToolTip(
const QString & toolTip
)
function isMinimumSliderDown
bool isMinimumSliderDown() const
Returns true if the minimum value handle is down, false if it is up.
function isMaximumSliderDown
bool isMaximumSliderDown() const
Returns true if the maximum value handle is down, false if it is up.
Protected Functions Documentation
function RangeSlider
RangeSlider(
RangeSliderPrivate * impl,
Qt::Orientation o,
QWidget * par =nullptr
)
function RangeSlider
RangeSlider(
RangeSliderPrivate * impl,
QWidget * par =nullptr
)
function mousePressEvent
virtual void mousePressEvent(
QMouseEvent * ev
) override
function mouseMoveEvent
virtual void mouseMoveEvent(
QMouseEvent * ev
) override
function mouseReleaseEvent
virtual void mouseReleaseEvent(
QMouseEvent * ev
) override
function paintEvent
virtual void paintEvent(
QPaintEvent * ev
) override
function initMinimumSliderStyleOption
virtual void initMinimumSliderStyleOption(
QStyleOptionSlider * option
) const
function initMaximumSliderStyleOption
virtual void initMaximumSliderStyleOption(
QStyleOptionSlider * option
) const
function event
virtual bool event(
QEvent * event
) override
Public Property Documentation
property minimumValue
int minimumValue;
property maximumValue
int maximumValue;
property minimumPosition
int minimumPosition;
property maximumPosition
int maximumPosition;
property symmetricMoves
bool symmetricMoves;
property handleToolTip
QString handleToolTip;
Protected Attributes Documentation
variable d_ptr
QScopedPointer< RangeSliderPrivate > d_ptr;
Updated on 2024-12-04 at 20:48:34 +0000