ParaView
pqSignalAdaptors.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqSignalAdaptors.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 
33 #ifndef pq_SignalAdaptors_h
34 #define pq_SignalAdaptors_h
35 
36 #include <QObject>
37 #include <QString>
38 #include <QVariant>
39 class QComboBox;
40 class QSlider;
41 class QTextEdit;
42 class QSpinBox;
43 
44 #include "pqWidgetsModule.h"
45 
46 
49 class PQWIDGETS_EXPORT pqSignalAdaptorComboBox : public QObject
50 {
51  Q_OBJECT
52  Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText)
53  Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
54  Q_PROPERTY(QVariant currentData READ currentData WRITE setCurrentData)
55 
56 public:
58  pqSignalAdaptorComboBox(QComboBox* p);
60  QString currentText() const;
62  int currentIndex() const;
63 
65  QVariant currentData() const;
66 
67 signals:
69  void currentTextChanged(const QString&);
70 
71  void currentIndexChanged(int);
72 public slots:
74  void setCurrentText(const QString&);
75 
77  void setCurrentIndex(int index);
78 
80  void setCurrentData(const QVariant& data);
81 protected:
82 };
83 
85 class PQWIDGETS_EXPORT pqSignalAdaptorColor : public QObject
86 {
87  Q_OBJECT
88  Q_PROPERTY(QVariant color READ color WRITE setColor)
89 public:
91  pqSignalAdaptorColor(QObject* p, const char* colorProperty, const char* signal,
92  bool enableAlpha);
94  QVariant color() const;
95 
96 signals:
98  void colorChanged(const QVariant&);
99 public slots:
101  void setColor(const QVariant&);
102 protected slots:
103  void handleColorChanged();
104 protected:
105  QByteArray PropertyName;
107 };
108 
109 
111 class PQWIDGETS_EXPORT pqSignalAdaptorSliderRange : public QObject
112 {
113  Q_OBJECT
114  Q_PROPERTY(double value READ value WRITE setValue)
115 public:
117  pqSignalAdaptorSliderRange(QSlider* p);
119  double value() const;
120 signals:
122  void valueChanged(double val);
123 public slots:
125  void setValue(double val);
126 protected slots:
127  void handleValueChanged();
128 };
129 
131 class PQWIDGETS_EXPORT pqSignalAdaptorTextEdit : public QObject
132 {
133  Q_OBJECT
134  Q_PROPERTY(QString text READ text WRITE setText)
135 
136 public:
138  pqSignalAdaptorTextEdit(QTextEdit* p);
140  QString text() const;
141 signals:
143  void textChanged();
144 public slots:
145  void setText(const QString&);
146 protected:
147 };
148 
149 
151 class PQWIDGETS_EXPORT pqSignalAdaptorSpinBox : public QObject
152 {
153  Q_OBJECT
154  Q_PROPERTY(int value READ value WRITE setValue)
155 
156 public:
158  pqSignalAdaptorSpinBox(QSpinBox* p);
160  int value() const;
161 signals:
163  void valueChanged(int val);
164 public slots:
165  void setValue(int val);
166 protected:
167 };
168 
169 #endif
170 
signal adaptor to allow getting/setting/observing of an rgba (0.0 - 1.0 range)
signal adaptor that lets us get the text inside a QTextEdit
signal adaptor to adjust the range of a int slider to (0.0-1.0)
signal adaptor to allow getting/setting/observing of a pseudo &#39;currentText&#39; property of a combo box t...
signal adaptor that lets us set/get the integer value inside a QSpinBox