itom 2.2.1
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2016, Institut fuer Technische Optik (ITO), 00005 Universitaet Stuttgart, Germany 00006 00007 This file is part of itom and its software development toolkit (SDK). 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 In addition, as a special exception, the Institut fuer Technische 00015 Optik (ITO) gives you certain additional rights. 00016 These rights are described in the ITO LGPL Exception version 1.0, 00017 which can be found in the file LGPL_EXCEPTION.txt in this package. 00018 00019 itom is distributed in the hope that it will be useful, but 00020 WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00022 General Public Licence for more details. 00023 00024 You should have received a copy of the GNU Library General Public License 00025 along with itom. If not, see <http://www.gnu.org/licenses/>. 00026 00027 This file is a port and modified version of the 00028 Common framework (http://www.commontk.org) 00029 *********************************************************************** */ 00030 00031 #ifndef DOUBLERANGESLIDER_H 00032 #define DOUBLERANGESLIDER_H 00033 00034 // Qt includes 00035 #include <QWidget> 00036 #include <QSlider> 00037 00038 #include "commonWidgets.h" 00039 00040 class RangeSlider; 00041 class DoubleRangeSliderPrivate; 00042 class ValueProxy; 00043 00049 class ITOMWIDGETS_EXPORT DoubleRangeSlider : public QWidget 00050 { 00051 Q_OBJECT 00052 Q_PROPERTY(double minimum READ minimum WRITE setMinimum) 00053 Q_PROPERTY(double maximum READ maximum WRITE setMaximum) 00054 Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep) 00055 Q_PROPERTY(double minimumValue READ minimumValue WRITE setMinimumValue) 00056 Q_PROPERTY(double maximumValue READ maximumValue WRITE setMaximumValue) 00057 Q_PROPERTY(double minimumPosition READ minimumPosition WRITE setMinimumPosition) 00058 Q_PROPERTY(double maximumPosition READ maximumPosition WRITE setMaximumPosition) 00059 Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking) 00060 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) 00061 Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval) 00062 Q_PROPERTY(QSlider::TickPosition tickPosition READ tickPosition WRITE setTickPosition) 00063 Q_PROPERTY(bool symmetricMoves READ symmetricMoves WRITE setSymmetricMoves) 00064 public: 00065 // Superclass typedef 00066 typedef QWidget Superclass; 00067 00070 DoubleRangeSlider( Qt::Orientation o, QWidget* par= 0 ); 00071 00074 DoubleRangeSlider( QWidget* par = 0 ); 00075 00077 virtual ~DoubleRangeSlider(); 00078 00084 void setSingleStep(double ss); 00085 double singleStep()const; 00086 00091 bool isValidStep(double step)const; 00092 00098 void setTickInterval(double ti); 00099 double tickInterval()const; 00100 00105 void setTickPosition(QSlider::TickPosition position); 00106 QSlider::TickPosition tickPosition()const; 00107 00113 double minimum()const; 00114 void setMinimum(double min); 00115 00121 double maximum()const; 00122 void setMaximum(double max); 00123 00127 void setRange(double min, double max); 00128 00134 double minimumValue() const; 00135 00141 double maximumValue() const; 00142 00146 double minimumPosition() const; 00147 void setMinimumPosition(double minPos); 00148 00152 double maximumPosition() const; 00153 void setMaximumPosition(double maxPos); 00154 00158 void setPositions(double minPos, double maxPos); 00159 00167 void setTracking(bool enable); 00168 bool hasTracking()const; 00169 00174 void triggerAction(QAbstractSlider::SliderAction action); 00175 00179 Qt::Orientation orientation()const; 00180 void setOrientation(Qt::Orientation orientation); 00181 00185 bool symmetricMoves()const; 00186 void setSymmetricMoves(bool symmetry); 00187 00190 void setValueProxy(ValueProxy* proxy); 00191 ValueProxy* valueProxy() const; 00192 00193 signals: 00197 void minimumValueChanged(double minVal); 00198 00202 void maximumValueChanged(double maxVal); 00203 00206 void valuesChanged(double minVal, double maxVal); 00207 00213 void minimumPositionChanged(double minPos); 00214 00220 void maximumPositionChanged(double maxPos); 00221 00225 void positionsChanged(double minPos, double maxPos); 00226 00230 void sliderPressed(); 00231 00235 void sliderReleased(); 00236 00242 void rangeChanged(double min, double max); 00243 00244 public slots: 00250 void setMinimumValue(double minVal); 00251 00257 void setMaximumValue(double maxVal); 00258 00261 void setValues(double minVal, double maxVal); 00262 00263 protected slots: 00264 void onValuesChanged(int min, int max); 00265 00266 void onMinPosChanged(int value); 00267 void onMaxPosChanged(int value); 00268 void onPositionsChanged(int min, int max); 00269 void onRangeChanged(int min, int max); 00270 00271 void onValueProxyAboutToBeModified(); 00272 void onValueProxyModified(); 00273 00274 protected: 00275 RangeSlider* slider()const; 00277 void setSlider(RangeSlider* slider); 00278 00279 protected: 00280 QScopedPointer<DoubleRangeSliderPrivate> d_ptr; 00281 00282 private: 00283 Q_DECLARE_PRIVATE(DoubleRangeSlider); 00284 Q_DISABLE_COPY(DoubleRangeSlider); 00285 }; 00286 00287 #endif