pqDoubleSliderWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqDoubleSliderWidget.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 #ifndef pqDoubleSliderWidget_H
16 #define pqDoubleSliderWidget_H
17 
18 #include "pqDoubleLineEdit.h"
19 #include "pqWidgetsModule.h"
20 #include <QWidget>
21 
22 class QDoubleValidator;
23 class QSlider;
24 
28 class PQWIDGETS_EXPORT pqDoubleSliderWidget : public QWidget
29 {
30  Q_OBJECT
31  Q_PROPERTY(double value READ value WRITE setValue USER true)
32  Q_PROPERTY(pqDoubleLineEdit::RealNumberNotation notation READ notation WRITE setNotation)
33  Q_PROPERTY(int precision READ precision WRITE setPrecision)
34  Q_PROPERTY(bool useGlobalPrecisionAndNotation READ useGlobalPrecisionAndNotation WRITE
35  setUseGlobalPrecisionAndNotation)
36 public:
37  pqDoubleSliderWidget(QWidget* parent = NULL);
39 
43  double value() const;
44 
49  pqDoubleLineEdit::RealNumberNotation notation() const;
50 
55  int precision() const;
56 
62  bool useGlobalPrecisionAndNotation() const;
63 
64 Q_SIGNALS:
68  void valueChanged(double);
69 
76  void valueEdited(double);
77 
78 public Q_SLOTS:
82  void setValue(double val);
83 
88  void setNotation(pqDoubleLineEdit::RealNumberNotation _notation);
89 
94  void setPrecision(int precision);
95 
100  void setUseGlobalPrecisionAndNotation(bool value);
101 
102 protected:
103  virtual int valueToSliderPos(double val);
104  virtual double sliderPosToValue(int pos);
105  void setValidator(QDoubleValidator* validator);
106  const QDoubleValidator* validator() const;
107  void setSliderRange(int min, int max);
108  void updateSlider();
109 
110 private Q_SLOTS:
111  void sliderChanged(int val);
112  void textChanged(const QString& text);
113  void editingFinished();
114  void sliderPressed();
115  void sliderReleased();
116  void emitValueEdited();
117  void emitIfDeferredValueEdited();
118 
119 private:
120  double Value;
121  QSlider* Slider;
122  pqDoubleLineEdit* DoubleLineEdit;
123  bool BlockUpdate;
124  bool InteractingWithSlider;
125  bool DeferredValueEdited;
126 };
127 
128 #endif
A widget with a tied slider and line edit for editing a double property.
#define PQWIDGETS_EXPORT
pqLineEdit subclass that supports a low precision view when inactive
#define const
Definition: zconf.h:235