itom
Loading...
Searching...
No Matches
rangeWidget.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 RANGEWIDGET_H
32#define RANGEWIDGET_H
33
34// Qt includes
35#include <QSlider>
36
37
38#include "commonWidgets.h"
39
40class RangeSlider;
41class QSpinBox;
43
44namespace ito {
45 class IntervalMeta; //forward declaration
46}
47
53class ITOMWIDGETS_EXPORT RangeWidget : public QWidget
54{
55 Q_OBJECT
56 Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
57 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
58 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
59 Q_PROPERTY(int minimumValue READ minimumValue WRITE setMinimumValue)
60 Q_PROPERTY(int maximumValue READ maximumValue WRITE setMaximumValue)
61 Q_PROPERTY(uint stepSizeValue READ stepSizeValue WRITE setStepSizeValue)
62 Q_PROPERTY(uint minimumRange READ minimumRange WRITE setMinimumRange)
63 Q_PROPERTY(uint maximumRange READ maximumRange WRITE setMaximumRange)
64 Q_PROPERTY(uint stepSizeRange READ stepSizeRange WRITE setStepSizeRange)
65 Q_PROPERTY(bool rangeIncludeLimits READ rangeIncludeLimits WRITE setRangeIncludeLimits)
66 Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
67 Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
68 Q_PROPERTY(int tickInterval READ tickInterval WRITE setTickInterval)
69 Q_PROPERTY(bool autoSpinBoxWidth READ isAutoSpinBoxWidth WRITE setAutoSpinBoxWidth)
70 Q_PROPERTY(Qt::Alignment spinBoxTextAlignment READ spinBoxTextAlignment WRITE setSpinBoxTextAlignment)
71 Q_PROPERTY(Qt::Alignment spinBoxAlignment READ spinBoxAlignment WRITE setSpinBoxAlignment)
72 Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
73 Q_PROPERTY(bool symmetricMoves READ symmetricMoves WRITE setSymmetricMoves)
74
75public:
77 typedef QWidget Superclass;
78
82 explicit RangeWidget(QWidget* parent = 0);
83
85 virtual ~RangeWidget();
86
93 virtual int minimum()const;
94 virtual void setMinimum(int minimum);
95
102 virtual int maximum()const;
103 virtual void setMaximum(int maximum);
106 virtual void setRange(int min, int max);
107 virtual void range(int minimumAndMaximum[2])const;
108
113 virtual int minimumValue()const;
114
119 virtual int maximumValue()const;
120
124 virtual void values(int &minValue, int &maxValue)const;
125
131 virtual int singleStep()const;
132 virtual void setSingleStep(int step);
133
137 uint stepSizeValue() const;
138 void setStepSizeValue(uint stepSize);
139
143 uint minimumRange() const;
144 void setMinimumRange(uint min);
145
149 uint maximumRange() const;
150 void setMaximumRange(uint max);
151
155 uint stepSizeRange() const;
156 void setStepSizeRange(uint stepSize);
157
162 bool rangeIncludeLimits() const;
163 void setRangeIncludeLimits(bool include);
164
169 virtual QString prefix()const;
170 virtual void setPrefix(const QString& prefix);
171
176 virtual QString suffix()const;
177 virtual void setSuffix(const QString& suffix);
178
184 virtual int tickInterval()const;
185 virtual void setTickInterval(int ti);
186
191 virtual void setSpinBoxAlignment(Qt::Alignment alignment);
192 virtual Qt::Alignment spinBoxAlignment()const;
193
198 virtual void setSpinBoxTextAlignment(Qt::Alignment alignment);
199 virtual Qt::Alignment spinBoxTextAlignment()const;
200
207 virtual void setTracking(bool enable);
208 virtual bool hasTracking()const;
209
214 // RangeWidget siblings.
215 virtual bool isAutoSpinBoxWidth()const;
216 virtual void setAutoSpinBoxWidth(bool autoWidth);
217
221 virtual bool symmetricMoves()const;
222 virtual void setSymmetricMoves(bool symmetry);
223
226 virtual RangeSlider* slider()const;
229 virtual QSpinBox* minimumSpinBox()const;
232 virtual QSpinBox* maximumSpinBox()const;
233
238 void setLimitsFromIntervalMeta(const ito::IntervalMeta &intervalMeta);
239
240public Q_SLOTS:
243 virtual void reset();
244 virtual void setMinimumValue(int value);
245 virtual void setMaximumValue(int value);
248 virtual void setValues(int minValue, int maxValue);
249
250Q_SIGNALS:
253 //void sliderMoved(int position);
254 void minimumValueChanged(int value);
255 void minimumValueIsChanging(int value);
256 void maximumValueChanged(int value);
257 void maximumValueIsChanging(int value);
258 void valuesChanged(int minValue, int maxValue);
259 void rangeChanged(int min, int max);
260
261protected Q_SLOTS:
262 virtual void startChanging();
263 virtual void stopChanging();
264 virtual void changeValues(int newMinValue, int newMaxValue);
265 virtual void changeMinimumValue(int value);
266 virtual void changeMaximumValue(int value);
268 virtual void setSliderValues();
269 virtual void setMinimumToMaximumSpinBox(int minimum);
270 virtual void setMaximumToMinimumSpinBox(int maximum);
271 virtual void onSliderRangeChanged(int min, int max);
272
273protected:
274 virtual bool eventFilter(QObject *obj, QEvent *event);
275
277 void setSlider(RangeSlider* slider);
278
279protected:
280 QScopedPointer<RangeWidgetPrivate> d_ptr;
281
282private:
283 Q_DECLARE_PRIVATE(RangeWidget);
284 Q_DISABLE_COPY(RangeWidget);
285
286};
287
288#endif
Definition rangeSlider.h:62
Definition rangeWidget.h:54
void minimumValueChanged(int value)
QWidget Superclass
Superclass typedef.
Definition rangeWidget.h:77
Definition rangeWidget.cpp:49
Meta-information for Param of type IntArrayMeta that represent an interval [minimum,...
Definition paramMeta.h:957
Definition apiFunctionsGraph.cpp:40