itom
Loading...
Searching...
No Matches
rangeSlider.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26
27 This file is a port and modified version of the
28 Common framework (http://www.commontk.org)
29*********************************************************************** */
30
31#ifndef RANGESLIDER_H
32#define RANGESLIDER_H
33
34#include <QSlider>
35
36#include "commonWidgets.h"
37
38
39class QStylePainter;
41
42namespace ito {
43 class IntervalMeta; //forward declaration
44}
45
61class ITOMWIDGETS_EXPORT RangeSlider : public QSlider
62{
63 Q_OBJECT
64 Q_PROPERTY(int minimumValue READ minimumValue WRITE setMinimumValue)
65 Q_PROPERTY(int maximumValue READ maximumValue WRITE setMaximumValue)
66 Q_PROPERTY(int minimumPosition READ minimumPosition WRITE setMinimumPosition)
67 Q_PROPERTY(int maximumPosition READ maximumPosition WRITE setMaximumPosition)
68 Q_PROPERTY(uint stepSizePosition READ stepSizePosition WRITE setStepSizePosition)
69 Q_PROPERTY(uint minimumRange READ minimumRange WRITE setMinimumRange)
70 Q_PROPERTY(uint maximumRange READ maximumRange WRITE setMaximumRange)
71 Q_PROPERTY(uint stepSizeRange READ stepSizeRange WRITE setStepSizeRange)
72 Q_PROPERTY(bool rangeIncludeLimits READ rangeIncludeLimits WRITE setRangeIncludeLimits)
73 Q_PROPERTY(bool symmetricMoves READ symmetricMoves WRITE setSymmetricMoves)
74 Q_PROPERTY(QString handleToolTip READ handleToolTip WRITE setHandleToolTip)
75 Q_PROPERTY(bool useStyleSheets READ useStyleSheets WRITE setUseStyleSheets) // special property to allow a basic support for style sheets (else one handle is not displayed among others)
76 Q_PROPERTY(float handleBorderRadius READ handleBorderRadius WRITE setHandleBorderRadius) // special property to indicate the border radius of the handles (only if useStyleSheets is true)
77
78public:
79 // Superclass typedef
80 typedef QSlider Superclass;
84 explicit RangeSlider( Qt::Orientation o, QWidget* par= 0 );
85 explicit RangeSlider( QWidget* par = 0 );
86 virtual ~RangeSlider();
87
93 int minimumValue() const;
94
100 int maximumValue() const;
101
105 int minimumPosition() const;
106 void setMinimumPosition(int min);
107
111 int maximumPosition() const;
112 void setMaximumPosition(int max);
113
117 uint stepSizePosition() const;
118 void setStepSizePosition(uint stepSize);
119
123 uint minimumRange() const;
124 void setMinimumRange(uint min);
125
129 uint maximumRange() const;
130 void setMaximumRange(uint max);
131
135 uint stepSizeRange() const;
136 void setStepSizeRange(uint stepSize);
137
142 bool rangeIncludeLimits() const;
143 void setRangeIncludeLimits(bool include);
144
148 void setPositions(int min, int max);
149
153 bool symmetricMoves()const;
154 void setSymmetricMoves(bool symmetry);
155
161 bool useStyleSheets()const;
162 void setUseStyleSheets(bool useStyleSheets);
163
169 float handleBorderRadius()const;
170 void setHandleBorderRadius(float radius);
171
177 QString handleToolTip()const;
178 void setHandleToolTip(const QString& toolTip);
179
182 bool isMinimumSliderDown()const;
185 bool isMaximumSliderDown()const;
186
191 void setLimitsFromIntervalMeta(const ito::IntervalMeta &intervalMeta);
192
193signals:
197 void minimumValueChanged(int min);
201 void maximumValueChanged(int max);
204 void valuesChanged(int min, int max);
205
212
219
223 void positionsChanged(int min, int max);
224
225public slots:
232 void setMinimumValue(int min);
233
240 void setMaximumValue(int max);
241
249 void setValues(int min, int max);
250
251protected slots:
252 void onRangeChanged(int minimum, int maximum);
253
254protected:
255 RangeSlider( RangeSliderPrivate* impl, Qt::Orientation o, QWidget* par= 0 );
256 RangeSlider( RangeSliderPrivate* impl, QWidget* par = 0 );
257
258 // Description:
259 // Standard Qt UI events
260 virtual void mousePressEvent(QMouseEvent* ev);
261 virtual void mouseMoveEvent(QMouseEvent* ev);
262 virtual void mouseReleaseEvent(QMouseEvent* ev);
263
264 virtual void keyPressEvent(QKeyEvent* ev);
265
266 // Description:
267 // Rendering is done here.
268 virtual void paintEvent(QPaintEvent* ev);
269 virtual void initMinimumSliderStyleOption(QStyleOptionSlider* option) const;
270 virtual void initMaximumSliderStyleOption(QStyleOptionSlider* option) const;
271
272 // Description:
273 // Reimplemented for the tooltips
274 virtual bool event(QEvent* event);
275
276protected:
277 QScopedPointer<RangeSliderPrivate> d_ptr;
278
279private:
280 Q_DECLARE_PRIVATE(RangeSlider);
281 Q_DISABLE_COPY(RangeSlider);
282};
283
284#endif
Definition rangeSlider.h:62
void maximumPositionChanged(int max)
void minimumValueChanged(int min)
void minimumPositionChanged(int min)
void valuesChanged(int min, int max)
Utility signal that is fired when minimum or maximum values have changed.
void maximumValueChanged(int max)
void positionsChanged(int min, int max)
Definition rangeSlider.cpp:46
Meta-information for Param of type IntArrayMeta that represent an interval [minimum,...
Definition paramMeta.h:957
Definition apiFunctionsGraph.cpp:40