CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
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 
32 class ctkDoubleSliderPrivate;
33 class ctkValueProxy;
34 
44 class 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 
61 public:
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 
216 
217 public Q_SLOTS:
223  void setValue(double value);
224 
228  void setOrientation(Qt::Orientation orientation);
229 
230 Q_SIGNALS:
234  void valueChanged(double value);
235 
241  void sliderMoved(double position);
242 
247 
252 
258  void rangeChanged(double min, double max);
259 
260 protected Q_SLOTS:
261  void onValueChanged(int value);
262  void onSliderMoved(int position);
263  void onRangeChanged(int min, int max);
266 
267 protected:
268  QScopedPointer<ctkDoubleSliderPrivate> d_ptr;
269 
270 private:
271  Q_DECLARE_PRIVATE(ctkDoubleSlider);
272  Q_DISABLE_COPY(ctkDoubleSlider);
273 };
274 
275 #endif
ctkDoubleSlider::tickInterval
double tickInterval() const
ctkDoubleSlider::setSliderPosition
void setSliderPosition(double)
ctkDoubleSlider::d_ptr
QScopedPointer< ctkDoubleSliderPrivate > d_ptr
Definition: ctkDoubleSlider.h:268
ctkDoubleSlider::Superclass
QWidget Superclass
Superclass typedef.
Definition: ctkDoubleSlider.h:63
ctkDoubleSlider::value
double value() const
ctkDoubleSlider::setSingleStep
void setSingleStep(double step)
ctkDoubleSlider::onRangeChanged
void onRangeChanged(int min, int max)
ctkDoubleSlider::orientation
Qt::Orientation orientation() const
ctkDoubleSlider::tickPosition
QSlider::TickPosition tickPosition() const
ctkDoubleSlider::hasTracking
bool hasTracking() const
ctkDoubleSlider::onValueProxyModified
void onValueProxyModified()
ctkDoubleSlider::singleStep
double singleStep() const
ctkDoubleSlider::minimum
double minimum() const
ctkDoubleSlider::valueChanged
void valueChanged(double value)
ctkDoubleSlider::sliderPosition
double sliderPosition() const
ctkDoubleSlider::isValidStep
bool isValidStep(double step) const
ctkWrapPythonQt.action
action
Definition: ctkWrapPythonQt.py:214
ctkDoubleSlider::eventFilter
virtual bool eventFilter(QObject *, QEvent *)
Reimplemented for internal reasons (handle tooltip).
ctkDoubleSlider::setRange
void setRange(double min, double max)
ctkDoubleSlider::setPageStep
void setPageStep(double step)
ctkDoubleSlider::setValueProxy
void setValueProxy(ctkValueProxy *proxy)
ctkDoubleSlider::slider
QSlider * slider() const
ctkDoubleSlider::ctkDoubleSlider
ctkDoubleSlider(Qt::Orientation orient, QWidget *parent=0)
ctkDoubleSlider::maximum
double maximum() const
ctkDoubleSlider::onValueProxyAboutToBeModified
void onValueProxyAboutToBeModified()
ctkDoubleSlider::setValue
void setValue(double value)
ctkDoubleSlider::setOrientation
void setOrientation(Qt::Orientation orientation)
ctkDoubleSlider::setTickPosition
void setTickPosition(QSlider::TickPosition position)
ctkDoubleSlider::onValueChanged
void onValueChanged(int value)
ctkDoubleSlider::invertedAppearance
bool invertedAppearance() const
ctkDoubleSlider
Definition: ctkDoubleSlider.h:45
ctkDoubleSlider::sliderPressed
void sliderPressed()
ctkValueProxy
Base class for value proxies. Value proxy allows to decouple the displayed value from the values acce...
Definition: ctkValueProxy.h:47
ctkDoubleSlider::setTickInterval
void setTickInterval(double ti)
ctkDoubleSlider::setInvertedControls
void setInvertedControls(bool invertedControls)
ctkDoubleSlider::setTracking
void setTracking(bool enable)
ctkPimpl.h
ctkDoubleSlider::pageStep
double pageStep() const
ctkDoubleSlider::invertedControls
bool invertedControls() const
ctkDoubleSlider::sliderReleased
void sliderReleased()
ctkDoubleSlider::ctkDoubleSlider
ctkDoubleSlider(QWidget *parent=0)
ctkDoubleSlider::handleToolTip
QString handleToolTip() const
ctkDoubleSlider::valueProxy
ctkValueProxy * valueProxy() const
ctkDoubleSlider::setHandleToolTip
void setHandleToolTip(const QString &toolTip)
ctkDoubleSlider::rangeChanged
void rangeChanged(double min, double max)
ctkDoubleSlider::sliderMoved
void sliderMoved(double position)
ctkDoubleSlider::setMaximum
void setMaximum(double max)
ctkDoubleSlider::setInvertedAppearance
void setInvertedAppearance(bool invertedAppearance)
ctkDoubleSlider::onSliderMoved
void onSliderMoved(int position)
ctkDoubleSlider::triggerAction
void triggerAction(QAbstractSlider::SliderAction action)
ctkDoubleSlider::setMinimum
void setMinimum(double min)
ctkDoubleSlider::~ctkDoubleSlider
virtual ~ctkDoubleSlider()
Destructor.