VTK  9.7.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;
19 class QVTKOpenGLWindow;
21 class vtkRenderWindow;
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());
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 
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 
101  {
102  this->VTKOpenGLWindow->setEnableTouchEventProcessing(enable);
103  }
105  {
106  return this->VTKOpenGLWindow->enableTouchEventProcessing();
107  }
108 
112  void setEnableHiDPI(bool enable) { this->VTKOpenGLWindow->setEnableHiDPI(enable); }
113  bool enableHiDPI() const { return this->VTKOpenGLWindow->enableHiDPI(); }
114 
116 
120  void setUnscaledDPI(int dpi) { this->VTKOpenGLWindow->setUnscaledDPI(dpi); }
121  int unscaledDPI() const { return this->VTKOpenGLWindow->unscaledDPI(); }
123 
125 
138  void setCustomDevicePixelRatio(double cdpr)
139  {
140  this->VTKOpenGLWindow->setCustomDevicePixelRatio(cdpr);
141  };
142  double customDevicePixelRatio() const { return this->VTKOpenGLWindow->customDevicePixelRatio(); };
144  {
145  return this->VTKOpenGLWindow->effectiveDevicePixelRatio();
146  };
148 
150 
153  void setDefaultCursor(const QCursor& cursor) { this->VTKOpenGLWindow->setDefaultCursor(cursor); }
154  const QCursor& defaultCursor() const { return this->VTKOpenGLWindow->defaultCursor(); }
156 
158 
162  void setCursorCustom(const QCursor& cursor) { this->VTKOpenGLWindow->setCursor(cursor); };
163  QCursor cursorCustom() const { return this->VTKOpenGLWindow->cursor(); }
165 
170  bool isValid() { return this->VTKOpenGLWindow->isValid(); }
171 
176  QImage grabFramebuffer();
177 
181  QVTKOpenGLWindow* embeddedOpenGLWindow() const { return this->VTKOpenGLWindow; }
182 
192  void setFormat(const QSurfaceFormat& fmt) { this->VTKOpenGLWindow->setFormat(fmt); }
193 
197  QSurfaceFormat format() const { return this->VTKOpenGLWindow->format(); }
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 VTK_ABI_NAMESPACE_END
208 #endif
void setRenderWindow(vtkGenericOpenGLRenderWindow *win)
Set a render window to use.
void setCursorCustom(const QCursor &cursor)
Set/get the cursor to use for this widget.
void setEnableTouchEventProcessing(bool enable)
Enable or disable support for touch event processing.
const QCursor & defaultCursor() const
Set/get the default cursor to use for this widget.
void setFormat(const QSurfaceFormat &fmt)
Sets the requested surface format.
QVTKInteractor * interactor() const
Get the QVTKInteractor that was either created by default or set by the user.
void setEnableHiDPI(bool enable)
Enable or disable support for HiDPI displays.
vtkRenderWindow * renderWindow() const
Returns the render window that is being shown in this widget.
an interactor for QVTKOpenGLNativeWidget (and QVTKWiget).
QCursor cursorCustom() const
Set/get the cursor to use for this widget.
platform-independent render window interaction including picking and frame rate control.
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
QSurfaceFormat format() const
Returns the context and surface format used by this widget and its toplevel window.
platform independent render window
int unscaledDPI() const
Set/Get unscaled DPI value.
display a vtkGenericOpenGLRenderWindow in a Qt QOpenGLWindow.
bool enableTouchEventProcessing() const
QWidget for displaying a vtkRenderWindow in a Qt Application.
void setDefaultCursor(const QCursor &cursor)
Set/get the default cursor to use for this widget.
double customDevicePixelRatio() const
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
double effectiveDevicePixelRatio() const
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
void setRenderWindow(vtkRenderWindow *win)
Set a render window to use.
create a window for renderers to draw into
QVTKOpenGLWindow * embeddedOpenGLWindow() const
Returns the embedded QVTKOpenGLWindow.
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
void setUnscaledDPI(int dpi)
Set/Get unscaled DPI value.
void setCustomDevicePixelRatio(double cdpr)
Set/Get a custom device pixel ratio to use to map Qt sizes to VTK (or OpenGL) sizes.
bool isValid()
Returns true if the internal QOpenGLWindow's is valid, i.e.