pqPropertyWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqPropertyWidget.h
5 
6  Copyright (c) 2005-2012 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 pqPropertyWidget_h
33 #define pqPropertyWidget_h
34 
35 #include "pqComponentsModule.h"
36 
37 #include "pqPropertyLinks.h"
38 #include <QFrame>
39 #include <QPointer>
40 #include <QScopedPointer>
41 
43 class pqTimer;
44 class pqView;
45 class vtkPVXMLElement;
46 class vtkSMDomain;
47 class vtkSMProperty;
48 class vtkSMProxy;
54 {
55  Q_OBJECT
56  typedef QWidget Superclass;
57 
58 public:
59  pqPropertyWidget(vtkSMProxy* proxy, QWidget* parent = nullptr);
60  ~pqPropertyWidget() override;
61 
62  virtual void apply();
63  virtual void reset();
64 
66 
76  virtual void select() { this->Selected = true; }
77  virtual void selectPort(int portIndex) { Q_UNUSED(portIndex); }
78  virtual void deselect() { this->Selected = false; }
79  bool isSelected() const { return this->Selected; }
81 
82  // This method is called on pqPropertyWidget instances that pqProxyWidget
83  // deems that should be shown in current configuration. Subclasses can
84  // override this method to change the appearance of the widget based on
85  // whether advanced properties are currently being shown by the pqProxyWidget
86  // or not.
87  virtual void updateWidget(bool showing_advanced_properties)
88  {
89  Q_UNUSED(showing_advanced_properties);
90  }
91 
92  pqView* view() const;
93  vtkSMProxy* proxy() const;
94  vtkSMProperty* property() const;
95  using Superclass::property; // Don't hide superclass method
96 
101  virtual char* panelVisibility() const;
102  virtual void setPanelVisibility(const char* vis);
103 
114  virtual bool isSingleRowItem() const;
115 
116  bool showLabel() const;
117 
131  template <class T>
132  static QString getXMLName(T* object)
133  {
134  return QString(object->GetXMLName());
135  }
136 
140  const QList<QPointer<pqPropertyWidgetDecorator>>& decorators() const { return this->Decorators; }
141 
146  using Superclass::setProperty;
147 
151  static QString getTooltip(vtkSMProperty* property);
152 
157  static int hintsWidgetHeightNumberOfRows(vtkPVXMLElement* hints, int defaultValue = 10);
158 
159 Q_SIGNALS:
163  void viewChanged(pqView* view);
164 
169  void changeAvailable();
170 
175  void changeFinished();
176 
181  void restartRequired();
182 
183 public Q_SLOTS:
187  virtual void setView(pqView*);
188 
189 protected:
190  void addPropertyLink(QObject* qobject, const char* qproperty, const char* qsignal,
191  vtkSMProperty* smproperty, int smindex = -1);
192  void addPropertyLink(QObject* qobject, const char* qproperty, const char* qsignal,
193  vtkSMProxy* smproxy, vtkSMProperty* smproperty, int smindex = -1);
194  void removePropertyLink(QObject* qobject, const char* qproperty, const char* qsignal,
195  vtkSMProperty* smproperty, int smindex = -1);
196  void removePropertyLink(QObject* qobject, const char* qproperty, const char* qsignal,
197  vtkSMProxy* smproxy, vtkSMProperty* smproperty, int smindex = -1);
198  void setShowLabel(bool show);
199 
209  {
210  this->ChangeAvailableAsChangeFinished = status;
211  }
212 
218  void addDecorator(pqPropertyWidgetDecorator*);
219 
223  void removeDecorator(pqPropertyWidgetDecorator*);
224 
228  pqPropertyLinks& links() { return this->Links; }
229 
230 public:
231  void setProperty(vtkSMProperty* property);
232 
233 private:
236  friend class pqProxyWidget;
237 
238 private Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
242  void onChangeAvailable();
243 
244 private: // NOLINT(readability-redundant-access-specifiers)
245  vtkSMProxy* Proxy;
246  vtkSMProperty* Property;
247  QPointer<pqView> View;
248  QList<QPointer<pqPropertyWidgetDecorator>> Decorators;
249 
250  pqPropertyLinks Links;
251  bool ShowLabel;
252  bool ChangeAvailableAsChangeFinished;
253  bool Selected;
254 
255  const QScopedPointer<pqTimer> Timer;
256 
261  void modified();
262  void editingFinished();
263 };
264 
265 #endif // pqPropertyWidget_h
virtual void selectPort(int portIndex)
These methods are called by pqPropertiesPanel when the panel for proxy becomes active/deactive.
pqPropertyWidget represents a widget created for each property of a proxy on the pqPropertiesPanel (f...
virtual void updateWidget(bool showing_advanced_properties)
pqPropertyWidgetDecorator subclass that can combine multiple decorators using boolean operations...
const QList< QPointer< pqPropertyWidgetDecorator > > & decorators() const
Provides access to the decorators for this widget.
void setChangeAvailableAsChangeFinished(bool status)
For most pqPropertyWidget subclasses a changeAvailable() signal, corresponds to a changeFinished() si...
#define PQCOMPONENTS_EXPORT
virtual void deselect()
These methods are called by pqPropertiesPanel when the panel for proxy becomes active/deactive.
superclass for all SM properties
virtual void select()
These methods are called by pqPropertiesPanel when the panel for proxy becomes active/deactive.
bool isSelected() const
These methods are called by pqPropertiesPanel when the panel for proxy becomes active/deactive.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:54
pqPropertyLinks & links()
Provides access to the pqPropertyLinks instance.
represents the possible values a property can have
Definition: vtkSMDomain.h:49
static QString getXMLName(T *object)
Description: This static utility method returns the XML name for an object as a QString.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
pqProxyWidget represents a panel for a vtkSMProxy.
Definition: pqProxyWidget.h:58
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
pqPropertyWidgetDecorator provides a mechanism to decorate pqPropertyWidget instances to add logic to...