ParaView
pqPropertyLinksConnection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqPropertyLinksConnection.h
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 #ifndef pqPropertyLinksConnection_h
33 #define pqPropertyLinksConnection_h
34 
35 #include <QObject>
36 #include <QPointer>
37 
38 #include "pqCoreModule.h"
39 #include "vtkEventQtSlotConnect.h"
40 #include "vtkNew.h"
41 #include "vtkSMProperty.h"
42 #include "vtkSMProxy.h"
43 #include "vtkWeakPointer.h"
44 
45 class pqPropertyLinks;
46 
52 class PQCORE_EXPORT pqPropertyLinksConnection : public QObject
53 {
54  Q_OBJECT
55  typedef QObject Superclass;
56 public:
60  QObject* qobject, const char* qproperty, const char* qsignal,
61  vtkSMProxy* smproxy, vtkSMProperty* smproperty, int smindex,
62  bool use_unchecked_modified_event,
63  QObject* parentObject=0);
64 
65  virtual ~pqPropertyLinksConnection();
66 
67 
68  void setUseUncheckedProperties(bool useUnchecked);
69 
71  bool operator==(const pqPropertyLinksConnection& other) const;
72 
74  QObject* objectQt() const { return this->ObjectQt; }
75  const QString& propertyQt() const { return this->PropertyQt; }
76 
78  vtkSMProxy* proxy() const { return this->ProxySM; }
79  vtkSMProxy* proxySM() const { return this->ProxySM; }
80  vtkSMProperty* propertySM() const { return this->PropertySM; }
81  int indexSM() const { return this->IndexSM; }
82 
83 public slots:
86  void copyValuesFromServerManagerToQt(bool use_unchecked);
87 
90  void copyValuesFromQtToServerManager(bool use_unchecked);
91 
92 protected:
95  virtual void setQtValue(const QVariant& value);
96  virtual void setServerManagerValue(bool use_unchecked, const QVariant& value);
97  virtual QVariant currentQtValue() const;
98  virtual QVariant currentServerManagerValue(bool use_unchecked) const;
99 
100 signals:
103  void qtpropertyModified();
104 
107  void smpropertyModified();
108 
109 private:
110  Q_DISABLE_COPY(pqPropertyLinksConnection)
111  vtkNew<vtkEventQtSlotConnect> VTKConnector;
112 
113  QPointer<QObject> ObjectQt;
114  QString PropertyQt;
115  QString SignalQt;
116 
117  vtkWeakPointer<vtkSMProxy> ProxySM;
118  vtkWeakPointer<vtkSMProperty> PropertySM;
119  int IndexSM;
120 };
121 
122 #endif
QObject * objectQt() const
Provides access to the Qt QObject and property name.
pqPropertyLinksConnection is used by pqPropertyLinks to keep a QObject and vtkSMProperty linked toget...
const QString & propertyQt() const
vtkSMProperty * propertySM() const
vtkSMProxy * proxy() const
Provides access to the ServerManager proxy/property/index.