VAPOR3 3.9.4
QRangeSlider.h
Go to the documentation of this file.
1#pragma once
2
3#include <QSlider>
4
5class QStylePainter;
6
9class QRangeSlider : public QSlider {
10 Q_OBJECT
11
12public:
14 QRangeSlider(Qt::Orientation orientation);
15 QSize minimumSizeHint() const;
16 void SetValue(float min, float max);
17 void setStyle(QStyle *style) = delete;
18
19signals:
23 void ValueChangedIntermediate(float min, float max);
25 void ValueChanged(float min, float max);
26
27protected:
28 void paintEvent(QPaintEvent *event);
29 void mousePressEvent(QMouseEvent *event);
30 void mouseReleaseEvent(QMouseEvent *event);
31 void mouseMoveEvent(QMouseEvent *event);
32 // void mouseDoubleClickEvent(QMouseEvent *event);
33
34private:
35 int _position[2];
36 int _value[2];
37 bool _isOutOfBounds[2] = {false};
38 float _outOfBoundValue[2];
39 int _grabbedControl = -1;
40 int _lastSelectedControl = 0;
41
42 bool _grabbedBar = false;
43 int _grabbedBarPosition;
44 int _grabbedBarStartPosition;
45 int _grabbedBarControlStartPositions[2];
46
47 void paintHandle(QStylePainter &p, int i);
48 void paintTrack(QStylePainter &p);
49 bool doesHandleContainPixel(int handle, const QPoint &pixel) const;
50 bool doesGrooveContainPixel(const QPoint &pixel) const;
51 bool isSliderDown(int i) const;
52 void swapSliders();
53 void emitValueChanged(bool intermediate = false);
54};
void paintEvent(QPaintEvent *event)
QRangeSlider(Qt::Orientation orientation)
void ValueChangedIntermediate(float min, float max)
User changed the value but they have not finalized it.
void mousePressEvent(QMouseEvent *event)
void setStyle(QStyle *style)=delete
void ValueChanged(float min, float max)
User finalized changing the value.
void ValueChangedBegin()
User began to change the value.
void mouseMoveEvent(QMouseEvent *event)
void SetValue(float min, float max)
void mouseReleaseEvent(QMouseEvent *event)
QSize minimumSizeHint() const