VTK  9.0.1
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 // Forward Qt class declarations
25 class QSurfaceFormat;
26 class QOpenGLContext;
27 
28 // class QVTKInteractor;
30 class QVTKOpenGLWindow;
32 class vtkRenderWindow;
34 
64 class VTKGUISUPPORTQT_EXPORT QVTKOpenGLStereoWidget : public QWidget
65 {
66  Q_OBJECT
67  typedef QWidget Superclass;
68 
69 public:
70  QVTKOpenGLStereoWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
72  QOpenGLContext* shareContext, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
73  QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow* w, QWidget* parent = nullptr,
74  Qt::WindowFlags f = Qt::WindowFlags());
75  QVTKOpenGLStereoWidget(vtkGenericOpenGLRenderWindow* w, QOpenGLContext* shareContext,
76  QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
77  ~QVTKOpenGLStereoWidget() override;
78 
80 
84  {
85  this->VTKOpenGLWindow->setRenderWindow(win);
86  }
87  void setRenderWindow(vtkRenderWindow* win) { this->VTKOpenGLWindow->setRenderWindow(win); }
89 
93  vtkRenderWindow* renderWindow() const { return this->VTKOpenGLWindow->renderWindow(); }
94 
98  QVTKInteractor* interactor() const { return this->VTKOpenGLWindow->interactor(); }
99 
103  static QSurfaceFormat defaultFormat(bool stereo_capable = false)
104  {
105  return QVTKOpenGLWindow::defaultFormat(stereo_capable);
106  }
107 
111  void setEnableHiDPI(bool enable) { this->VTKOpenGLWindow->setEnableHiDPI(enable); }
112  bool enableHiDPI() const { return this->VTKOpenGLWindow->enableHiDPI(); }
113 
115 
119  void setUnscaledDPI(int dpi) { this->VTKOpenGLWindow->setUnscaledDPI(dpi); }
120  int unscaledDPI() const { return this->VTKOpenGLWindow->unscaledDPI(); }
122 
124 
127  void setDefaultCursor(const QCursor& cursor) { this->VTKOpenGLWindow->setDefaultCursor(cursor); }
128  const QCursor& defaultCursor() const { return this->VTKOpenGLWindow->defaultCursor(); }
130 
135  bool isValid() { return this->VTKOpenGLWindow->isValid(); }
136 
141  QImage grabFramebuffer();
142 
146  QVTKOpenGLWindow* embeddedOpenGLWindow() const { return this->VTKOpenGLWindow; }
147 
157  void setFormat(const QSurfaceFormat& fmt) { this->VTKOpenGLWindow->setFormat(fmt); }
158 
162  QSurfaceFormat format() const { return this->VTKOpenGLWindow->format(); }
163 
165 
168  VTK_LEGACY(void SetRenderWindow(vtkGenericOpenGLRenderWindow* win));
169  VTK_LEGACY(void SetRenderWindow(vtkRenderWindow* win));
171 
173 
178  VTK_LEGACY(vtkRenderWindow* GetRenderWindow());
179  VTK_LEGACY(QVTKInteractor* GetInteractor());
181 
186  VTK_LEGACY(QVTKInteractorAdapter* GetInteractorAdapter());
187 
192  VTK_LEGACY(void setQVTKCursor(const QCursor& cursor));
193 
197  VTK_LEGACY(void setDefaultQVTKCursor(const QCursor& cursor));
198 
199 protected:
200  void resizeEvent(QResizeEvent* evt) override;
201  void paintEvent(QPaintEvent* evt) override;
202 
203 private:
204  QPointer<QVTKOpenGLWindow> VTKOpenGLWindow;
205 };
206 
207 #endif
QVTKOpenGLStereoWidget::format
QSurfaceFormat format() const
Returns the context and surface format used by this widget and its toplevel window.
Definition: QVTKOpenGLStereoWidget.h:162
QVTKOpenGLWindow::defaultFormat
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
QVTKOpenGLStereoWidget::embeddedOpenGLWindow
QVTKOpenGLWindow * embeddedOpenGLWindow() const
Returns the embedded QVTKOpenGLWindow.
Definition: QVTKOpenGLStereoWidget.h:146
QVTKOpenGLStereoWidget::setRenderWindow
void setRenderWindow(vtkGenericOpenGLRenderWindow *win)
Set a render window to use.
Definition: QVTKOpenGLStereoWidget.h:83
QVTKOpenGLWindow
display a vtkGenericOpenGLRenderWindow in a Qt QOpenGLWindow.
Definition: QVTKOpenGLWindow.h:65
vtkGenericOpenGLRenderWindow
platform independent render window
Definition: vtkGenericOpenGLRenderWindow.h:42
QVTKOpenGLStereoWidget::interactor
QVTKInteractor * interactor() const
Get the QVTKInteractor that was either created by default or set by the user.
Definition: QVTKOpenGLStereoWidget.h:98
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:103
QVTKOpenGLStereoWidget::setEnableHiDPI
void setEnableHiDPI(bool enable)
Enable or disable support for HiDPI displays.
Definition: QVTKOpenGLStereoWidget.h:111
QVTKInteractorAdapter
Definition: QVTKInteractorAdapter.h:50
QVTKOpenGLStereoWidget::enableHiDPI
bool enableHiDPI() const
Definition: QVTKOpenGLStereoWidget.h:112
QVTKOpenGLStereoWidget::setFormat
void setFormat(const QSurfaceFormat &fmt)
Sets the requested surface format.
Definition: QVTKOpenGLStereoWidget.h:157
QVTKOpenGLStereoWidget::renderWindow
vtkRenderWindow * renderWindow() const
Returns the render window that is being shown in this widget.
Definition: QVTKOpenGLStereoWidget.h:93
QVTKOpenGLStereoWidget::setDefaultCursor
void setDefaultCursor(const QCursor &cursor)
Set/get the default cursor to use for this widget.
Definition: QVTKOpenGLStereoWidget.h:127
QVTKOpenGLStereoWidget::defaultCursor
const QCursor & defaultCursor() const
Definition: QVTKOpenGLStereoWidget.h:128
QVTKOpenGLStereoWidget::unscaledDPI
int unscaledDPI() const
Definition: QVTKOpenGLStereoWidget.h:120
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:82
QVTKOpenGLStereoWidget::isValid
bool isValid()
Returns true if the internal QOpenGLWindow's is valid, i.e.
Definition: QVTKOpenGLStereoWidget.h:135
QVTKOpenGLWindow.h
QVTKOpenGLStereoWidget::setRenderWindow
void setRenderWindow(vtkRenderWindow *win)
Definition: QVTKOpenGLStereoWidget.h:87
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:93
QVTKOpenGLStereoWidget::setUnscaledDPI
void setUnscaledDPI(int dpi)
Set/Get unscaled DPI value.
Definition: QVTKOpenGLStereoWidget.h:119
QVTKInteractor
an interactor for QVTKOpenGLNativeWidget (and QVTKWiget).
Definition: QVTKInteractor.h:58
QVTKOpenGLStereoWidget
QWidget for displaying a vtkRenderWindow in a Qt Application.
Definition: QVTKOpenGLStereoWidget.h:64