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
ctkRangeSlider.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 __ctkRangeSlider_h
22#define __ctkRangeSlider_h
23
24// Qt includes
25#include <QSlider>
26
27// CTK includes
28#include <ctkPimpl.h>
29
30#include "ctkWidgetsExport.h"
31
32class QStylePainter;
33class ctkRangeSliderPrivate;
34
50class CTK_WIDGETS_EXPORT ctkRangeSlider : public QSlider
51{
52 Q_OBJECT
53 Q_PROPERTY(int minimumValue READ minimumValue WRITE setMinimumValue)
54 Q_PROPERTY(int maximumValue READ maximumValue WRITE setMaximumValue)
55 Q_PROPERTY(int minimumPosition READ minimumPosition WRITE setMinimumPosition)
56 Q_PROPERTY(int maximumPosition READ maximumPosition WRITE setMaximumPosition)
57 Q_PROPERTY(bool symmetricMoves READ symmetricMoves WRITE setSymmetricMoves)
58 Q_PROPERTY(QString handleToolTip READ handleToolTip WRITE setHandleToolTip)
59
60public:
61 // Superclass typedef
62 typedef QSlider Superclass;
66 explicit ctkRangeSlider( Qt::Orientation o, QWidget* par= 0 );
67 explicit ctkRangeSlider( QWidget* par = 0 );
68 virtual ~ctkRangeSlider();
69
75 int minimumValue() const;
76
82 int maximumValue() const;
83
87 int minimumPosition() const;
88 void setMinimumPosition(int min);
89
93 int maximumPosition() const;
94 void setMaximumPosition(int max);
95
99 void setPositions(int min, int max);
100
104 bool symmetricMoves()const;
105 void setSymmetricMoves(bool symmetry);
106
112 QString handleToolTip()const;
113 void setHandleToolTip(const QString& toolTip);
114
117 bool isMinimumSliderDown()const;
120 bool isMaximumSliderDown()const;
121
122Q_SIGNALS:
126 void minimumValueChanged(int min);
130 void maximumValueChanged(int max);
133 void valuesChanged(int min, int max);
134
140 void minimumPositionChanged(int min);
141
147 void maximumPositionChanged(int max);
148
152 void positionsChanged(int min, int max);
153
154public Q_SLOTS:
161 void setMinimumValue(int min);
162
169 void setMaximumValue(int max);
170
178 void setValues(int min, int max);
179
180protected Q_SLOTS:
181 void onRangeChanged(int minimum, int maximum);
182
183protected:
184 ctkRangeSlider( ctkRangeSliderPrivate* impl, Qt::Orientation o, QWidget* par= 0 );
185 ctkRangeSlider( ctkRangeSliderPrivate* impl, QWidget* par = 0 );
186
187 // Description:
188 // Standard Qt UI events
189 virtual void mousePressEvent(QMouseEvent* ev);
190 virtual void mouseMoveEvent(QMouseEvent* ev);
191 virtual void mouseReleaseEvent(QMouseEvent* ev);
192
193 // Description:
194 // Rendering is done here.
195 virtual void paintEvent(QPaintEvent* ev);
196 virtual void initMinimumSliderStyleOption(QStyleOptionSlider* option) const;
197 virtual void initMaximumSliderStyleOption(QStyleOptionSlider* option) const;
198
199 // Description:
200 // Reimplemented for the tooltips
201 virtual bool event(QEvent* event);
202
203protected:
204 QScopedPointer<ctkRangeSliderPrivate> d_ptr;
205
206private:
207 Q_DECLARE_PRIVATE(ctkRangeSlider);
208 Q_DISABLE_COPY(ctkRangeSlider);
209};
210
211#endif
212