pqQVTKWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqQVTKWidget_h
5 #define pqQVTKWidget_h
6 
7 #include "QVTKInteractor.h"
8 #include "pqCoreModule.h"
9 #include "pqQVTKWidgetBase.h"
10 #include "vtkEventQtSlotConnect.h"
11 #include "vtkNew.h"
12 #include "vtkRenderWindow.h"
13 #include "vtkSmartPointer.h"
14 #include "vtkWeakPointer.h"
15 
16 #include <QVariant>
17 #include <QWidget>
18 
19 class vtkSMProxy;
20 class vtkSMSession;
21 
35 class PQCORE_EXPORT pqQVTKWidget : public QWidget
36 {
37  Q_OBJECT
38  typedef QWidget Superclass;
39 
40 public:
41  pqQVTKWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags{});
42  pqQVTKWidget(QWidget* parentObject, Qt::WindowFlags f, bool isStereo);
43  ~pqQVTKWidget() override;
44 
48  void setViewProxy(vtkSMProxy*);
49 
54  void setSession(vtkSMSession*);
55 
59  vtkTypeUInt32 getProxyId();
60 
65  void setSizePropertyName(const QString& pname) { this->SizePropertyName = pname; }
66  const QString& sizePropertyName() const { return this->SizePropertyName; }
67 
68  void notifyQApplication(QMouseEvent*);
69 
73  void setRenderWindow(vtkRenderWindow* win);
74  vtkRenderWindow* renderWindow() const;
75 
76  QVTKInteractor* interactor() const;
77  bool isValid();
78 
79  void setEnableHiDPI(bool flag);
80  void setCustomDevicePixelRatio(double cdpr);
81  double effectiveDevicePixelRatio() const;
82  void setViewSize(int width, int height);
83 
88  QWidget* renderWidget() const;
89 
91 
97  void setCursorCustom(const QCursor& cursor);
98  QCursor cursorCustom() const;
100 
101 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
102  void paintMousePointer(int x, int y);
103 
104 private Q_SLOTS:
105  void prepareContextForRendering();
106 
107 protected:
108  bool renderVTK();
109  bool canRender();
110 
111 #if PARAVIEW_USING_QVTKOPENGLSTEREOWIDGET
112  void resizeEvent(QResizeEvent* evt) override;
113 #endif
114 
115 private:
116  Q_DISABLE_COPY(pqQVTKWidget)
117  vtkSmartPointer<vtkSMProxy> ViewProxy;
119  QString SizePropertyName;
121 
122  bool useStereo;
123  QVariant baseClass;
124 };
125 
128 
129 #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:65
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:22
QWidget subclass to show rendering results from vtkSMViewProxy.
Definition: pqQVTKWidget.h:35
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
height
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
vtkGenericOpenGLRenderWindow pqQVTKWidgetBaseRenderWindowType
Definition: pqQVTKWidget.h:126
const QString & sizePropertyName() const
Definition: pqQVTKWidget.h:66