|
OpenHantek
|
Slider widget for multiple level sliders. These are used for the trigger levels, offsets and so on. More...
#include <levelslider.h>
Signals | |
| void | valueChanged (int index, double value) |
| The value of a slider has changed. More... | |
Public Member Functions | |
| LevelSlider (Qt::ArrowType direction=Qt::RightArrow, QWidget *parent=nullptr) | |
| Initializes the slider container. More... | |
| ~LevelSlider () | |
| Cleans up the widget. More... | |
| QSize | sizeHint () const |
| Size hint for the widget. More... | |
| int | preMargin () const |
| Return the margin before the slider. More... | |
| int | postMargin () const |
| Return the margin after the slider. More... | |
| int | addSlider (int index=-1) |
| Add a new slider to the slider container. More... | |
| int | addSlider (const QString &text, int index=-1) |
| Add a new slider to the slider container. More... | |
| int | removeSlider (int index=-1) |
| Remove a slider from the slider container. More... | |
| const QColor | color (int index) const |
| Return the color of a slider. More... | |
| void | setColor (unsigned index, QColor color) |
| Set the color of the slider. More... | |
| const QString | text (int index) const |
| Return the text shown beside a slider. More... | |
| int | setText (int index, const QString &text) |
| Set the text for a slider. More... | |
| bool | visible (int index) const |
| Return the visibility of a slider. More... | |
| void | setIndexVisible (unsigned index, bool visible) |
| Set the visibility of a slider. More... | |
| double | minimum (int index) const |
| Return the minimal value of the sliders. More... | |
| double | maximum (int index) const |
| Return the maximal value of the sliders. More... | |
| void | setLimits (int index, double minimum, double maximum) |
| Set the maximal value of the sliders. More... | |
| double | step (int index) const |
| Return the step width of the sliders. More... | |
| double | setStep (int index, double step) |
| Set the step width of the sliders. More... | |
| double | value (int index) const |
| Return the current position of a slider. More... | |
| void | setValue (int index, double value) |
| Set the current position of a slider. More... | |
| Qt::ArrowType | direction () const |
| Return the direction of the sliders. More... | |
| int | setDirection (Qt::ArrowType direction) |
| Set the direction of the sliders. More... | |
Protected Member Functions | |
| void | mouseMoveEvent (QMouseEvent *event) |
| Move the slider if it's pressed. More... | |
| void | mousePressEvent (QMouseEvent *event) |
| Prepare slider for movement if the left mouse button is pressed. More... | |
| void | mouseReleaseEvent (QMouseEvent *event) |
| Movement is done if the left mouse button is released. More... | |
| void | paintEvent (QPaintEvent *event) |
| Paint the widget. More... | |
| void | resizeEvent (QResizeEvent *event) |
| Resize the widget and adapt the slider positions. More... | |
| QRect | calculateRect (int sliderId) |
| Calculate the drawing area for the slider for it's current value. More... | |
| int | calculateWidth () |
| Search for the widest slider element. More... | |
| void | fixValue (int index) |
| Fix the value if it's outside the limits. More... | |
Protected Attributes | |
| QList< LevelSliderParameters * > | slider |
| The parameters for each slider. More... | |
| int | pressedSlider |
| The currently pressed (moved) slider. More... | |
| int | sliderWidth |
| Qt::ArrowType | _direction |
| The direction the sliders point to. More... | |
| int | _preMargin |
| The margin before the minimum slider position. More... | |
| int | _postMargin |
| The margin after the maximum slider position. More... | |
Slider widget for multiple level sliders. These are used for the trigger levels, offsets and so on.
| LevelSlider::LevelSlider | ( | Qt::ArrowType | direction = Qt::RightArrow, |
| QWidget * | parent = nullptr |
||
| ) |
Initializes the slider container.
| direction | The side on which the sliders are shown. |
| parent | The parent widget. |
| LevelSlider::~LevelSlider | ( | ) |
Cleans up the widget.
| int LevelSlider::addSlider | ( | int | index = -1 | ) |
Add a new slider to the slider container.
| index | The index where the slider should be inserted, 0 to append. |
| int LevelSlider::addSlider | ( | const QString & | text, |
| int | index = -1 |
||
| ) |
Add a new slider to the slider container.
| text | The text that will be shown next to the slider. |
| index | The index where the slider should be inserted, 0 to append. |
|
protected |
Calculate the drawing area for the slider for it's current value.
| sliderId | The id of the slider whose rect should be calculated. |
|
protected |
Search for the widest slider element.
| const QColor LevelSlider::color | ( | int | index | ) | const |
Return the color of a slider.
| index | The index of the slider whose color should be returned. |
| Qt::ArrowType LevelSlider::direction | ( | ) | const |
Return the direction of the sliders.
|
protected |
Fix the value if it's outside the limits.
| index | The index of the slider who should be fixed. |
| double LevelSlider::maximum | ( | int | index | ) | const |
Return the maximal value of the sliders.
| double LevelSlider::minimum | ( | int | index | ) | const |
Return the minimal value of the sliders.
|
protected |
Move the slider if it's pressed.
| event | The mouse event that should be handled. |
|
protected |
Prepare slider for movement if the left mouse button is pressed.
| event | The mouse event that should be handled. |
|
protected |
Movement is done if the left mouse button is released.
| event | The mouse event that should be handled. |
|
protected |
Paint the widget.
| event | The paint event that should be handled. |
| int LevelSlider::postMargin | ( | ) | const |
Return the margin after the slider.
| int LevelSlider::preMargin | ( | ) | const |
Return the margin before the slider.
| int LevelSlider::removeSlider | ( | int | index = -1 | ) |
Remove a slider from the slider container.
| index | The index of the slider that should be removed. |
|
protected |
Resize the widget and adapt the slider positions.
| event | The resize event that should be handled. |
| void LevelSlider::setColor | ( | unsigned | index, |
| QColor | color | ||
| ) |
Set the color of the slider.
| index | The index of the slider whose color should be set. |
| color | The new color for the slider. |
| int LevelSlider::setDirection | ( | Qt::ArrowType | direction | ) |
Set the direction of the sliders.
| direction | The side on which the sliders are shown. |
| void LevelSlider::setIndexVisible | ( | unsigned | index, |
| bool | visible | ||
| ) |
Set the visibility of a slider.
| index | The index of the slider whose visibility should be set. |
| visible | true to show the slider, false to hide it. |
| void LevelSlider::setLimits | ( | int | index, |
| double | minimum, | ||
| double | maximum | ||
| ) |
Set the maximal value of the sliders.
| index | The index of the slider whose limits should be set. |
| minimum | The value a slider has at the bottommost/leftmost position. |
| maximum | The value a slider has at the topmost/rightmost position. |
| double LevelSlider::setStep | ( | int | index, |
| double | step | ||
| ) |
Set the step width of the sliders.
| index | The index of the slider whose step width should be set. |
| step | The distance between the selectable slider positions. |
| int LevelSlider::setText | ( | int | index, |
| const QString & | text | ||
| ) |
Set the text for a slider.
| index | The index of the slider whose text should be set. |
| text | The text shown next to the slider. |
| void LevelSlider::setValue | ( | int | index, |
| double | value | ||
| ) |
Set the current position of a slider.
| index | The index of the slider whose value should be set. |
| value | The new value of the slider. |
| QSize LevelSlider::sizeHint | ( | ) | const |
Size hint for the widget.
| double LevelSlider::step | ( | int | index | ) | const |
Return the step width of the sliders.
| index | The index of the slider whose step width should be returned. |
| const QString LevelSlider::text | ( | int | index | ) | const |
Return the text shown beside a slider.
| index | The index of the slider whose text should be returned. |
| double LevelSlider::value | ( | int | index | ) | const |
Return the current position of a slider.
| index | The index of the slider whose value should be returned. |
|
signal |
The value of a slider has changed.
| bool LevelSlider::visible | ( | int | index | ) | const |
Return the visibility of a slider.
| index | The index of the slider whose visibility should be returned. |
|
protected |
The direction the sliders point to.
|
protected |
The margin after the maximum slider position.
|
protected |
The margin before the minimum slider position.
|
protected |
The currently pressed (moved) slider.
|
protected |
The parameters for each slider.
|
protected |
The slider width (dimension orthogonal to the sliding direction)