ParaView
ctkDoubleRangeSlider.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 /*=========================================================================
33 
34  Library: CTK
35 
36  Copyright (c) Kitware Inc.
37 
38  Licensed under the Apache License, Version 2.0 (the "License");
39  you may not use this file except in compliance with the License.
40  You may obtain a copy of the License at
41 
42  http://www.apache.org/licenses/LICENSE-2.0.txt
43 
44  Unless required by applicable law or agreed to in writing, software
45  distributed under the License is distributed on an "AS IS" BASIS,
46  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47  See the License for the specific language governing permissions and
48  limitations under the License.
49 
50 =========================================================================*/
51 
52 #ifndef ctkDoubleRangeSlider_h
53 #define ctkDoubleRangeSlider_h
54 
55 // Qt includes
56 #include <QSlider>
57 #include <QWidget>
58 
59 // PQ includes
60 #include "pqWidgetsModule.h"
61 
62 class ctkRangeSlider;
63 class ctkDoubleRangeSliderPrivate;
64 
70 class PQWIDGETS_EXPORT ctkDoubleRangeSlider : public QWidget
71 {
72  Q_OBJECT
73  Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
74  Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
75  Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
76  Q_PROPERTY(double minimumValue READ minimumValue WRITE setMinimumValue)
77  Q_PROPERTY(double maximumValue READ maximumValue WRITE setMaximumValue)
78  Q_PROPERTY(double minimumPosition READ minimumPosition WRITE setMinimumPosition)
79  Q_PROPERTY(double maximumPosition READ maximumPosition WRITE setMaximumPosition)
80  Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
81  Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
82  Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval)
83  Q_PROPERTY(QSlider::TickPosition tickPosition READ tickPosition WRITE setTickPosition)
84  Q_PROPERTY(bool symmetricMoves READ symmetricMoves WRITE setSymmetricMoves)
85 public:
86  // Superclass typedef
87  typedef QWidget Superclass;
88 
91  ctkDoubleRangeSlider( Qt::Orientation o, QWidget* par= 0 );
92 
95  ctkDoubleRangeSlider( QWidget* par = 0 );
96 
98  virtual ~ctkDoubleRangeSlider();
99 
104  void setSingleStep(double ss);
105  double singleStep()const;
106 
112  void setTickInterval(double ti);
113  double tickInterval()const;
114 
119  void setTickPosition(QSlider::TickPosition position);
120  QSlider::TickPosition tickPosition()const;
121 
127  double minimum()const;
128  void setMinimum(double min);
129 
135  double maximum()const;
136  void setMaximum(double max);
137 
141  void setRange(double min, double max);
142 
148  double minimumValue() const;
149 
155  double maximumValue() const;
156 
160  double minimumPosition() const;
161  void setMinimumPosition(double minPos);
162 
166  double maximumPosition() const;
167  void setMaximumPosition(double maxPos);
168 
172  void setPositions(double minPos, double maxPos);
173 
181  void setTracking(bool enable);
182  bool hasTracking()const;
183 
188  void triggerAction(QAbstractSlider::SliderAction action);
189 
193  Qt::Orientation orientation()const;
194  void setOrientation(Qt::Orientation orientation);
195 
199  bool symmetricMoves()const;
200  void setSymmetricMoves(bool symmetry);
201 
202 Q_SIGNALS:
206  void minimumValueChanged(double minVal);
207 
211  void maximumValueChanged(double maxVal);
212 
215  void valuesChanged(double minVal, double maxVal);
216 
222  void minimumPositionChanged(double minPos);
223 
229  void maximumPositionChanged(double maxPos);
230 
234  void positionsChanged(double minPos, double maxPos);
235 
239  void sliderPressed();
240 
244  void sliderReleased();
245 
251  void rangeChanged(double min, double max);
252 
253 public Q_SLOTS:
259  void setMinimumValue(double minVal);
260 
266  void setMaximumValue(double maxVal);
267 
270  void setValues(double minVal, double maxVal);
271 
272 protected Q_SLOTS:
273  void onValuesChanged(int min, int max);
274 
275  void onMinPosChanged(int value);
276  void onMaxPosChanged(int value);
277  void onPositionsChanged(int min, int max);
278  void onRangeChanged(int min, int max);
279 
280 protected:
281  ctkRangeSlider* slider()const;
283  void setSlider(ctkRangeSlider* slider);
284 
285 protected:
286  QScopedPointer<ctkDoubleRangeSliderPrivate> d_ptr;
287 
288 private:
289  Q_DECLARE_PRIVATE(ctkDoubleRangeSlider);
290  Q_DISABLE_COPY(ctkDoubleRangeSlider)
291 };
292 
293 #endif
A ctkRangeSlider is a slider that lets you input 2 values instead of one (see QSlider).
ctkDoubleRangeSlider is a slider that controls 2 numbers as double.