itom
Loading...
Searching...
No Matches
doubleRangeWidget.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 DOUBLERANGEWIDGET_H
32#define DOUBLERANGEWIDGET_H
33
34// Qt includes
35#include <QSlider>
36
37
38#include "commonWidgets.h"
39
41class DoubleSpinBox;
43class ValueProxy;
44
50class ITOMWIDGETS_EXPORT DoubleRangeWidget : public QWidget
51{
52 Q_OBJECT
53 Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
54 Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
55 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
56 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
57 Q_PROPERTY(double minimumValue READ minimumValue WRITE setMinimumValue)
58 Q_PROPERTY(double maximumValue READ maximumValue WRITE setMaximumValue)
59 Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
60 Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
61 Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval)
62 Q_PROPERTY(bool autoSpinBoxWidth READ isAutoSpinBoxWidth WRITE setAutoSpinBoxWidth)
63 Q_PROPERTY(Qt::Alignment spinBoxTextAlignment READ spinBoxTextAlignment WRITE setSpinBoxTextAlignment)
64 Q_PROPERTY(Qt::Alignment spinBoxAlignment READ spinBoxAlignment WRITE setSpinBoxAlignment)
65 Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
66 Q_PROPERTY(bool symmetricMoves READ symmetricMoves WRITE setSymmetricMoves)
67
68public:
70 typedef QWidget Superclass;
71
75 explicit DoubleRangeWidget(QWidget* parent = 0);
76
78 virtual ~DoubleRangeWidget();
79
86 virtual double minimum()const;
87 virtual void setMinimum(double minimum);
88
95 virtual double maximum()const;
96 virtual void setMaximum(double maximum);
99 virtual void setRange(double min, double max);
100 virtual void range(double minimumAndMaximum[2])const;
101
106 virtual double minimumValue()const;
107
112 virtual double maximumValue()const;
113
117 virtual void values(double &minValue, double &maxValue)const;
118
124 virtual double singleStep()const;
125 virtual void setSingleStep(double step);
126
129 virtual int decimals()const;
130
135 virtual QString prefix()const;
136 virtual void setPrefix(const QString& prefix);
137
142 virtual QString suffix()const;
143 virtual void setSuffix(const QString& suffix);
144
150 virtual double tickInterval()const;
151 virtual void setTickInterval(double ti);
152
157 virtual void setSpinBoxAlignment(Qt::Alignment alignment);
158 virtual Qt::Alignment spinBoxAlignment()const;
159
164 virtual void setSpinBoxTextAlignment(Qt::Alignment alignment);
165 virtual Qt::Alignment spinBoxTextAlignment()const;
166
173 virtual void setTracking(bool enable);
174 virtual bool hasTracking()const;
175
180 // RangeWidget siblings.
181 virtual bool isAutoSpinBoxWidth()const;
182 virtual void setAutoSpinBoxWidth(bool autoWidth);
183
187 virtual bool symmetricMoves()const;
188 virtual void setSymmetricMoves(bool symmetry);
189
192 virtual DoubleRangeSlider* slider()const;
195 virtual DoubleSpinBox* minimumSpinBox()const;
198 virtual DoubleSpinBox* maximumSpinBox()const;
199
202 virtual void setValueProxy(ValueProxy* proxy);
203 virtual ValueProxy* valueProxy() const;
204
205public Q_SLOTS:
208 virtual void reset();
209 virtual void setMinimumValue(double value);
210 virtual void setMaximumValue(double value);
213 virtual void setValues(double minValue, double maxValue);
214
217 virtual void setDecimals(int decimals);
218
219Q_SIGNALS:
222 //void sliderMoved(double position);
223 void minimumValueChanged(double value);
224 void minimumValueIsChanging(double value);
225 void maximumValueChanged(double value);
226 void maximumValueIsChanging(double value);
227 void valuesChanged(double minValue, double maxValue);
228 void rangeChanged(double min, double max);
229
230protected Q_SLOTS:
231 virtual void startChanging();
232 virtual void stopChanging();
233 virtual void changeValues(double newMinValue, double newMaxValue);
234 virtual void changeMinimumValue(double value);
235 virtual void changeMaximumValue(double value);
237 virtual void setSliderValues();
238 virtual void setMinimumToMaximumSpinBox(double minimum);
239 virtual void setMaximumToMinimumSpinBox(double maximum);
240 virtual void onSliderRangeChanged(double min, double max);
241
242 virtual void onValueProxyAboutToBeModified();
243 virtual void onValueProxyModified();
244
245protected:
246 virtual bool eventFilter(QObject *obj, QEvent *event);
247
249 virtual void setSlider(DoubleRangeSlider* slider);
250
251protected:
252 QScopedPointer<DoubleRangeWidgetPrivate> d_ptr;
253
254private:
255 Q_DECLARE_PRIVATE(DoubleRangeWidget);
256 Q_DISABLE_COPY(DoubleRangeWidget);
257
258};
259
260#endif
Definition doubleRangeSlider.h:50
Definition doubleRangeWidget.h:51
void minimumValueChanged(double value)
QWidget Superclass
Superclass typedef.
Definition doubleRangeWidget.h:70
Definition doubleRangeWidget.cpp:49
Custom SpinBox The DoubleSpinBox internally uses a QDoubleSpinBox while it retain controls over it.
Definition doubleSpinBox.h:55
Base class for value proxies. Value proxy allows to decouple the displayed value from the values acce...
Definition valueProxy.h:46