pqQVTKWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
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 pqQVTKWidget_h
33 #define pqQVTKWidget_h
34 
35 #include "QVTKInteractor.h"
36 #include "pqCoreModule.h"
37 #include "pqQVTKWidgetBase.h"
38 #include "vtkEventQtSlotConnect.h"
39 #include "vtkNew.h"
40 #include "vtkRenderWindow.h"
41 #include "vtkSmartPointer.h"
42 #include "vtkWeakPointer.h"
43 
44 #include <QVariant>
45 #include <QWidget>
46 
47 class vtkSMProxy;
48 class vtkSMSession;
49 
58 class PQCORE_EXPORT pqQVTKWidget : public QWidget
59 {
60  Q_OBJECT
61  typedef QWidget Superclass;
62 
63 public:
64  pqQVTKWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags{});
65  pqQVTKWidget(QWidget* parentObject, Qt::WindowFlags f, bool isStereo);
66  ~pqQVTKWidget() override;
67 
71  void setViewProxy(vtkSMProxy*);
72 
77  void setSession(vtkSMSession*);
78 
82  vtkTypeUInt32 getProxyId();
83 
88  void setSizePropertyName(const QString& pname) { this->SizePropertyName = pname; }
89  const QString& sizePropertyName() const { return this->SizePropertyName; }
90 
91  void notifyQApplication(QMouseEvent*);
92 
96  void setRenderWindow(vtkRenderWindow* win);
97  vtkRenderWindow* renderWindow() const;
98 
99  QVTKInteractor* interactor() const;
100  bool isValid();
101 
102  void setEnableHiDPI(bool flag);
103  void setCustomDevicePixelRatio(double cdpr);
104  double effectiveDevicePixelRatio() const;
105  void setViewSize(int width, int height);
106 
107 public Q_SLOTS:
108  void paintMousePointer(int x, int y);
109 
110 private Q_SLOTS:
111  void prepareContextForRendering();
112 
113 protected:
114  bool renderVTK();
115  bool canRender();
116 
117 #if PARAVIEW_USING_QVTKOPENGLSTEREOWIDGET
118  void resizeEvent(QResizeEvent* evt) override;
119 #endif
120 
121 private:
122  Q_DISABLE_COPY(pqQVTKWidget)
123  vtkSmartPointer<vtkSMProxy> ViewProxy;
125  QString SizePropertyName;
127 
128  bool useStereo;
129  QVariant baseClass;
130 };
131 
134 
135 #endif
void setSizePropertyName(const QString &pname)
Set/Get the name of the property to use to update the size of the widget on the proxy.
Definition: pqQVTKWidget.h:88
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:35
pqQVTKWidget has a QVTKOpenGL*Widget object to which it adds awareness for view proxies.
Definition: pqQVTKWidget.h:58
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
height
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
vtkGenericOpenGLRenderWindow pqQVTKWidgetBaseRenderWindowType
Definition: pqQVTKWidget.h:132
const QString & sizePropertyName() const
Definition: pqQVTKWidget.h:89