VTK: GUISupport/Qt/QVTKOpenGLStereoWidget.h Source File

| VTK 9.3.1

QVTKOpenGLStereoWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef QVTKOpenGLStereoWidget_h
4 #define QVTKOpenGLStereoWidget_h
5
6 #include "vtkGUISupportQtModule.h" // For export macro
7 #include <QWidget>
8
9 #include "QVTKOpenGLWindow.h" // needed for ivar
10 #include <QPointer> // needed for ivar
11
12 // Forward Qt class declarations
13 class QSurfaceFormat;
14 class QOpenGLContext;
15
16 VTK_ABI_NAMESPACE_BEGIN
17 // class QVTKInteractor;
18 class QVTKInteractorAdapter;
19 class QVTKOpenGLWindow;
20 class vtkGenericOpenGLRenderWindow;
21 class vtkRenderWindow;
22 class vtkRenderWindowInteractor;
23
53 class VTKGUISUPPORTQT_EXPORT QVTKOpenGLStereoWidget : public QWidget
54 {
55 Q_OBJECT
56 typedef QWidget Superclass;
57
58 public:
59 QVTKOpenGLStereoWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
60 QVTKOpenGLStereoWidget(
61 QOpenGLContext* shareContext, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
62 QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow* w, QWidget* parent = nullptr,
63 Qt::WindowFlags f = Qt::WindowFlags());
64 QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow* w, QOpenGLContext* shareContext,
65 QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
66 ~QVTKOpenGLStereoWidget() override;
67
69
72 void setRenderWindow(vtkGenericOpenGLRenderWindow* win)
73 {
74 this->VTKOpenGLWindow->setRenderWindow(win);
75 }
76 void setRenderWindow(vtkRenderWindow* win) { this->VTKOpenGLWindow->setRenderWindow(win); }
78
82 vtkRenderWindow* renderWindow() const { return this->VTKOpenGLWindow->renderWindow(); }
83
87 QVTKInteractor* interactor() const { return this->VTKOpenGLWindow->interactor(); }
88
92 static QSurfaceFormat defaultFormat(bool stereo_capable = false)
93 {
94 return QVTKOpenGLWindow::defaultFormat(stereo_capable);
95 }
96
100 void setEnableHiDPI(bool enable) { this->VTKOpenGLWindow->setEnableHiDPI(enable); }
101 bool enableHiDPI() const { return this->VTKOpenGLWindow->enableHiDPI(); }
102
104
108 void setUnscaledDPI(int dpi) { this->VTKOpenGLWindow->setUnscaledDPI(dpi); }
109 int unscaledDPI() const { return this->VTKOpenGLWindow->unscaledDPI(); }
111
113
126 void setCustomDevicePixelRatio(double cdpr)
127 {
128 this->VTKOpenGLWindow->setCustomDevicePixelRatio(cdpr);
129 };
130 double customDevicePixelRatio() const { return this->VTKOpenGLWindow->customDevicePixelRatio(); };
131 double effectiveDevicePixelRatio() const
132 {
133 return this->VTKOpenGLWindow->effectiveDevicePixelRatio();
134 };
136
138
141 void setDefaultCursor(const QCursor& cursor) { this->VTKOpenGLWindow->setDefaultCursor(cursor); }
142 const QCursor& defaultCursor() const { return this->VTKOpenGLWindow->defaultCursor(); }
144
146
150 void setCursorCustom(const QCursor& cursor) { this->VTKOpenGLWindow->setCursor(cursor); };
151 QCursor cursorCustom() const { return this->VTKOpenGLWindow->cursor(); }
153
158 bool isValid() { return this->VTKOpenGLWindow->isValid(); }
159
164 QImage grabFramebuffer();
165
169 QVTKOpenGLWindow* embeddedOpenGLWindow() const { return this->VTKOpenGLWindow; }
170
180 void setFormat(const QSurfaceFormat& fmt) { this->VTKOpenGLWindow->setFormat(fmt); }
181
185 QSurfaceFormat format() const { return this->VTKOpenGLWindow->format(); }
186
187 protected:
188 void resizeEvent(QResizeEvent* evt) override;
189 void paintEvent(QPaintEvent* evt) override;
190
191 private:
192 QPointer<QVTKOpenGLWindow> VTKOpenGLWindow;
193 };
194
195 VTK_ABI_NAMESPACE_END
196 #endif
QVTKOpenGLWindow.h
QVTKInteractorAdapter
Definition: QVTKInteractorAdapter.h:31
QVTKInteractor
an interactor for QVTKOpenGLNativeWidget (and QVTKWiget).
Definition: QVTKInteractor.h:38
QVTKOpenGLStereoWidget
QWidget for displaying a vtkRenderWindow in a Qt Application.
Definition: QVTKOpenGLStereoWidget.h:54
QVTKOpenGLStereoWidget::~QVTKOpenGLStereoWidget
~QVTKOpenGLStereoWidget() override
QVTKOpenGLStereoWidget::interactor
QVTKInteractor * interactor() const
Get the QVTKInteractor that was either created by default or set by the user.
Definition: QVTKOpenGLStereoWidget.h:87
QVTKOpenGLStereoWidget::embeddedOpenGLWindow
QVTKOpenGLWindow * embeddedOpenGLWindow() const
Returns the embedded QVTKOpenGLWindow.
Definition: QVTKOpenGLStereoWidget.h:169
QVTKOpenGLStereoWidget::setCustomDevicePixelRatio
void setCustomDevicePixelRatio(double cdpr)
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
Definition: QVTKOpenGLStereoWidget.h:126
QVTKOpenGLStereoWidget::cursorCustom
QCursor cursorCustom() const
Set/get the cursor to use for this widget.
Definition: QVTKOpenGLStereoWidget.h:151
QVTKOpenGLStereoWidget::setRenderWindow
void setRenderWindow(vtkRenderWindow *win)
Set a render window to use.
Definition: QVTKOpenGLStereoWidget.h:76
QVTKOpenGLStereoWidget::setEnableHiDPI
void setEnableHiDPI(bool enable)
Enable or disable support for HiDPI displays.
Definition: QVTKOpenGLStereoWidget.h:100
QVTKOpenGLStereoWidget::setDefaultCursor
void setDefaultCursor(const QCursor &cursor)
Set/get the default cursor to use for this widget.
Definition: QVTKOpenGLStereoWidget.h:141
QVTKOpenGLStereoWidget::setCursorCustom
void setCursorCustom(const QCursor &cursor)
Set/get the cursor to use for this widget.
Definition: QVTKOpenGLStereoWidget.h:150
QVTKOpenGLStereoWidget::paintEvent
void paintEvent(QPaintEvent *evt) override
QVTKOpenGLStereoWidget::grabFramebuffer
QImage grabFramebuffer()
Expose internal QVTKOpenGLWindow::grabFramebuffer().
QVTKOpenGLStereoWidget::defaultCursor
const QCursor & defaultCursor() const
Set/get the default cursor to use for this widget.
Definition: QVTKOpenGLStereoWidget.h:142
QVTKOpenGLStereoWidget::effectiveDevicePixelRatio
double effectiveDevicePixelRatio() const
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
Definition: QVTKOpenGLStereoWidget.h:131
QVTKOpenGLStereoWidget::renderWindow
vtkRenderWindow * renderWindow() const
Returns the render window that is being shown in this widget.
Definition: QVTKOpenGLStereoWidget.h:82
QVTKOpenGLStereoWidget::setUnscaledDPI
void setUnscaledDPI(int dpi)
Set/Get unscaled DPI value.
Definition: QVTKOpenGLStereoWidget.h:108
QVTKOpenGLStereoWidget::format
QSurfaceFormat format() const
Returns the context and surface format used by this widget and its toplevel window.
Definition: QVTKOpenGLStereoWidget.h:185
QVTKOpenGLStereoWidget::resizeEvent
void resizeEvent(QResizeEvent *evt) override
QVTKOpenGLStereoWidget::enableHiDPI
bool enableHiDPI() const
Definition: QVTKOpenGLStereoWidget.h:101
QVTKOpenGLStereoWidget::setFormat
void setFormat(const QSurfaceFormat &fmt)
Sets the requested surface format.
Definition: QVTKOpenGLStereoWidget.h:180
QVTKOpenGLStereoWidget::customDevicePixelRatio
double customDevicePixelRatio() const
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
Definition: QVTKOpenGLStereoWidget.h:130
QVTKOpenGLStereoWidget::defaultFormat
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
Definition: QVTKOpenGLStereoWidget.h:92
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget
QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow *w, QOpenGLContext *shareContext, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget
QVTKOpenGLStereoWidget(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget
QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow *w, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget
QVTKOpenGLStereoWidget(QOpenGLContext *shareContext, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
QVTKOpenGLStereoWidget::isValid
bool isValid()
Returns true if the internal QOpenGLWindow's is valid, i.e.
Definition: QVTKOpenGLStereoWidget.h:158
QVTKOpenGLStereoWidget::setRenderWindow
void setRenderWindow(vtkGenericOpenGLRenderWindow *win)
Set a render window to use.
Definition: QVTKOpenGLStereoWidget.h:72
QVTKOpenGLStereoWidget::unscaledDPI
int unscaledDPI() const
Set/Get unscaled DPI value.
Definition: QVTKOpenGLStereoWidget.h:109
QVTKOpenGLWindow
display a vtkGenericOpenGLRenderWindow in a Qt QOpenGLWindow.
Definition: QVTKOpenGLWindow.h:55
QVTKOpenGLWindow::defaultFormat
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
vtkGenericOpenGLRenderWindow
platform independent render window
Definition: vtkGenericOpenGLRenderWindow.h:41
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:82
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:95