ParaView
pqDoubleRangeWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqDoubleRangeWidget.h
5 
6  Copyright (c) 2005-2008 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 #ifndef pqDoubleRangeWidget_h
33 #define pqDoubleRangeWidget_h
34 
35 #include "pqWidgetsModule.h"
36 #include <QWidget>
37 
38 class QSlider;
39 class pqLineEdit;
40 
44 class PQWIDGETS_EXPORT pqDoubleRangeWidget : public QWidget
45 {
46  Q_OBJECT
47  Q_PROPERTY(double value READ value WRITE setValue USER true)
48  Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
49  Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
50  Q_PROPERTY(bool strictRange READ strictRange WRITE setStrictRange)
51  Q_PROPERTY(int resolution READ resolution WRITE setResolution)
52 public:
56  pqDoubleRangeWidget(QWidget* parent = NULL);
58 
62  double value() const;
63 
64  // get the min range value
65  double minimum() const;
66  // get the max range value
67  double maximum() const;
68 
69  // returns whether the line edit is also limited
70  bool strictRange() const;
71 
72  // returns the resolution.
73  int resolution() const;
74 
75 signals:
79  void valueChanged(double);
80 
86  void valueEdited(double);
87 
88 public slots:
92  void setValue(double);
93 
94  // set the min range value
95  void setMinimum(double);
96  // set the max range value
97  void setMaximum(double);
98 
99  // set the range on both the slider and line edit's validator
100  // whereas other methods just do it on the slider
101  void setStrictRange(bool);
102 
103  // set the resolution.
104  void setResolution(int);
105 
106 private slots:
107  void sliderChanged(int);
108  void textChanged(const QString&);
109  void editingFinished();
110  void updateValidator();
111  void updateSlider();
112 
113 private:
114  int Resolution;
115  double Value;
116  double Minimum;
117  double Maximum;
118  QSlider* Slider;
119  pqLineEdit* LineEdit;
120  bool BlockUpdate;
121  bool StrictRange;
122 };
123 
124 #endif
pqLineEdit is a specialization of QLineEdit which provide a new property &#39;text2&#39;. ...
Definition: pqLineEdit.h:53
a widget with a tied slider and line edit for editing a double property