CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkDoubleSlider.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkDoubleSlider_h
22#define __ctkDoubleSlider_h
23
24// Qt includes
25#include <QSlider>
26#include <QWidget>
27
28// CTK includes
29#include <ctkPimpl.h>
30#include "ctkWidgetsExport.h"
31
32class ctkDoubleSliderPrivate;
33class ctkValueProxy;
34
44class CTK_WIDGETS_EXPORT ctkDoubleSlider : public QWidget
45{
46 Q_OBJECT
47 Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
48 Q_PROPERTY(double sliderPosition READ sliderPosition WRITE setSliderPosition)
49 Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
50 Q_PROPERTY(double pageStep READ pageStep WRITE setPageStep)
51 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
52 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
53 Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval)
54 Q_PROPERTY(QSlider::TickPosition tickPosition READ tickPosition WRITE setTickPosition)
55 Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
56 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
57 Q_PROPERTY(QString handleToolTip READ handleToolTip WRITE setHandleToolTip)
58 Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
59 Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
60
61public:
63 typedef QWidget Superclass;
64
67 explicit ctkDoubleSlider(QWidget* parent = 0);
70 explicit ctkDoubleSlider(Qt::Orientation orient, QWidget* parent = 0);
72 virtual ~ctkDoubleSlider();
73
79 void setMinimum(double min);
80 double minimum()const;
81
87 void setMaximum(double max);
88 double maximum()const;
89
93 void setRange(double min, double max);
94
100 double value()const;
101
108 void setSingleStep(double step);
109 double singleStep()const;
110
115 bool isValidStep(double step)const;
116
122 void setPageStep(double step);
123 double pageStep()const;
124
130 void setTickInterval(double ti);
131 double tickInterval()const;
132
137 void setTickPosition(QSlider::TickPosition position);
138 QSlider::TickPosition tickPosition()const;
139
146 double sliderPosition()const;
147 void setSliderPosition(double);
148
155 void setTracking(bool enable);
156 bool hasTracking()const;
157
162 void triggerAction(QAbstractSlider::SliderAction action);
163
167 Qt::Orientation orientation()const;
168
178 void setInvertedAppearance(bool invertedAppearance);
179 bool invertedAppearance()const;
180
187 void setInvertedControls(bool invertedControls);
188 bool invertedControls()const;
189
195 QString handleToolTip()const;
196 void setHandleToolTip(const QString& toolTip);
197
199 virtual bool eventFilter(QObject*, QEvent*);
200
204 QSlider* slider()const;
205
214 void setValueProxy(ctkValueProxy* proxy);
215 ctkValueProxy* valueProxy() const;
216
217public Q_SLOTS:
223 void setValue(double value);
224
228 void setOrientation(Qt::Orientation orientation);
229
230Q_SIGNALS:
234 void valueChanged(double value);
235
241 void sliderMoved(double position);
242
246 void sliderPressed();
247
251 void sliderReleased();
252
258 void rangeChanged(double min, double max);
259
260protected Q_SLOTS:
261 void onValueChanged(int value);
262 void onSliderMoved(int position);
263 void onRangeChanged(int min, int max);
264 void onValueProxyAboutToBeModified();
265 void onValueProxyModified();
266
267protected:
268 QScopedPointer<ctkDoubleSliderPrivate> d_ptr;
269
270private:
271 Q_DECLARE_PRIVATE(ctkDoubleSlider);
272 Q_DISABLE_COPY(ctkDoubleSlider);
273};
274
275#endif
QWidget Superclass
Superclass typedef.
Base class for value proxies. Value proxy allows to decouple the displayed value from the values acce...