VTK  9.1.0
QVTKOpenGLStereoWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: QVTKOpenGLStereoWidget.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15#ifndef QVTKOpenGLStereoWidget_h
16#define QVTKOpenGLStereoWidget_h
17
18#include "vtkGUISupportQtModule.h" // For export macro
19#include <QWidget>
20
21#include "QVTKOpenGLWindow.h" // needed for ivar
22#include <QPointer> // needed for ivar
23
24#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_0_0
25
26// Forward Qt class declarations
27class QSurfaceFormat;
28class QOpenGLContext;
29
30// class QVTKInteractor;
34class vtkRenderWindow;
36
66class VTKGUISUPPORTQT_EXPORT QVTKOpenGLStereoWidget : public QWidget
67{
68 Q_OBJECT
69 typedef QWidget Superclass;
70
71public:
72 QVTKOpenGLStereoWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
74 QOpenGLContext* shareContext, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
76 Qt::WindowFlags f = Qt::WindowFlags());
77 QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow* w, QOpenGLContext* shareContext,
78 QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
80
82
86 {
87 this->VTKOpenGLWindow->setRenderWindow(win);
88 }
89 void setRenderWindow(vtkRenderWindow* win) { this->VTKOpenGLWindow->setRenderWindow(win); }
91
95 vtkRenderWindow* renderWindow() const { return this->VTKOpenGLWindow->renderWindow(); }
96
100 QVTKInteractor* interactor() const { return this->VTKOpenGLWindow->interactor(); }
101
105 static QSurfaceFormat defaultFormat(bool stereo_capable = false)
106 {
107 return QVTKOpenGLWindow::defaultFormat(stereo_capable);
108 }
109
113 void setEnableHiDPI(bool enable) { this->VTKOpenGLWindow->setEnableHiDPI(enable); }
114 bool enableHiDPI() const { return this->VTKOpenGLWindow->enableHiDPI(); }
115
117
121 void setUnscaledDPI(int dpi) { this->VTKOpenGLWindow->setUnscaledDPI(dpi); }
122 int unscaledDPI() const { return this->VTKOpenGLWindow->unscaledDPI(); }
124
126
140 {
141 this->VTKOpenGLWindow->setCustomDevicePixelRatio(cdpr);
142 };
143 double customDevicePixelRatio() const { return this->VTKOpenGLWindow->customDevicePixelRatio(); };
145 {
146 return this->VTKOpenGLWindow->effectiveDevicePixelRatio();
147 };
149
151
154 void setDefaultCursor(const QCursor& cursor) { this->VTKOpenGLWindow->setDefaultCursor(cursor); }
155 const QCursor& defaultCursor() const { return this->VTKOpenGLWindow->defaultCursor(); }
157
162 bool isValid() { return this->VTKOpenGLWindow->isValid(); }
163
169
173 QVTKOpenGLWindow* embeddedOpenGLWindow() const { return this->VTKOpenGLWindow; }
174
184 void setFormat(const QSurfaceFormat& fmt) { this->VTKOpenGLWindow->setFormat(fmt); }
185
189 QSurfaceFormat format() const { return this->VTKOpenGLWindow->format(); }
190
192
195 VTK_DEPRECATED_IN_9_0_0("Use QVTKOpenGLStereoWidget::setRenderWindow")
196 void SetRenderWindow(vtkGenericOpenGLRenderWindow* win);
197 VTK_DEPRECATED_IN_9_0_0("Use QVTKOpenGLStereoWidget::setRenderWindow")
198 void SetRenderWindow(vtkRenderWindow* win);
200
202
208 vtkRenderWindow* GetRenderWindow();
209 VTK_DEPRECATED_IN_9_0_0("Removed in 9.0.0 (internal)")
210 QVTKInteractor* GetInteractor();
212
217 VTK_DEPRECATED_IN_9_0_0("Removed in 9.0.0 (internal)")
218 QVTKInteractorAdapter* GetInteractorAdapter();
219
224 VTK_DEPRECATED_IN_9_0_0("Use QWidget::setCursor")
225 void setQVTKCursor(const QCursor& cursor);
226
230 VTK_DEPRECATED_IN_9_0_0("Use QWidget::setDefaultCursor")
231 void setDefaultQVTKCursor(const QCursor& cursor);
232
233protected:
234 void resizeEvent(QResizeEvent* evt) override;
235 void paintEvent(QPaintEvent* evt) override;
236
237private:
238 QPointer<QVTKOpenGLWindow> VTKOpenGLWindow;
239};
240
241#endif
an interactor for QVTKOpenGLNativeWidget (and QVTKWiget).
QWidget for displaying a vtkRenderWindow in a Qt Application.
~QVTKOpenGLStereoWidget() override
void setCustomDevicePixelRatio(double cdpr)
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
vtkRenderWindow * renderWindow() const
Returns the render window that is being shown in this widget.
void setRenderWindow(vtkRenderWindow *win)
Set a render window to use.
void setEnableHiDPI(bool enable)
Enable or disable support for HiDPI displays.
void setDefaultCursor(const QCursor &cursor)
Set/get the default cursor to use for this widget.
const QCursor & defaultCursor() const
Set/get the default cursor to use for this widget.
QImage grabFramebuffer()
Expose internal QVTKOpenGLWindow::grabFramebuffer().
double effectiveDevicePixelRatio() const
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
QVTKInteractor * interactor() const
Get the QVTKInteractor that was either created by default or set by the user.
QVTKOpenGLWindow * embeddedOpenGLWindow() const
Returns the embedded QVTKOpenGLWindow.
void setUnscaledDPI(int dpi)
Set/Get unscaled DPI value.
QSurfaceFormat format() const
Returns the context and surface format used by this widget and its toplevel window.
void setFormat(const QSurfaceFormat &fmt)
Sets the requested surface format.
double customDevicePixelRatio() const
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow *w, QOpenGLContext *shareContext, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
QVTKOpenGLStereoWidget(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow *w, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
QVTKOpenGLStereoWidget(QOpenGLContext *shareContext, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
bool isValid()
Returns true if the internal QOpenGLWindow's is valid, i.e.
void setRenderWindow(vtkGenericOpenGLRenderWindow *win)
Set a render window to use.
int unscaledDPI() const
Set/Get unscaled DPI value.
display a vtkGenericOpenGLRenderWindow in a Qt QOpenGLWindow.
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
platform independent render window
platform-independent render window interaction including picking and frame rate control.
create a window for renderers to draw into
#define VTK_DEPRECATED_IN_9_0_0(reason)