VTK  9.1.0
QVTKRenderWindowAdapter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: QVTKRenderWindowAdapter.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 QVTKRenderWindowAdapter_h
16#define QVTKRenderWindowAdapter_h
17
37#include "vtkGUISupportQtModule.h" // For export macro
38#include <QObject>
39
40#include <QCursor> // for ivar
41#include <QScopedPointer> // for ivar
42
43class QOpenGLContext;
44class QSurfaceFormat;
45class QWidget;
46class QWindow;
48class vtkObject;
49
50class VTKGUISUPPORTQT_EXPORT QVTKRenderWindowAdapter : public QObject
51{
52 Q_OBJECT;
53 using Superclass = QObject;
54
55public:
57
65 QOpenGLContext* cntxt, vtkGenericOpenGLRenderWindow* window, QWindow* parent);
67 QOpenGLContext* cntxt, vtkGenericOpenGLRenderWindow* window, QWidget* parent);
69
71
94 static QSurfaceFormat defaultFormat(bool stereo_capable = false);
95
99 QOpenGLContext* context() const;
100
106 void paint();
107
119 void resize(int width, int height);
120
122
126 bool blit(
127 unsigned int targetId, int targetAttachement, const QRect& targetRect, bool left = true);
128 bool blitLeftEye(unsigned int targetId, int targetAttachement, const QRect& targetRect)
129 {
130 return this->blit(targetId, targetAttachement, targetRect, true);
131 }
132 bool blitRightEye(unsigned int targetId, int targetAttachement, const QRect& targetRect)
133 {
134 return this->blit(targetId, targetAttachement, targetRect, false);
135 }
137
142 bool handleEvent(QEvent* evt);
143
145
148 void setDefaultCursor(const QCursor& cursor) { this->DefaultCursor = cursor; }
149 const QCursor& defaultCursor() const { return this->DefaultCursor; }
151
153
165
167
173
175
181
182private Q_SLOTS:
183 void contextAboutToBeDestroyed();
184
185private:
187 QOpenGLContext* cntxt, vtkGenericOpenGLRenderWindow* window, QObject* widgetOrWindow);
188 Q_DISABLE_COPY(QVTKRenderWindowAdapter);
189
190 class QVTKInternals;
191 QScopedPointer<QVTKInternals> Internals;
192
193 QCursor DefaultCursor;
194};
195
196#endif
Helper to manage Qt context and other OpenGL components.
static QSurfaceFormat defaultFormat(bool stereo_capable=false)
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
bool blitLeftEye(unsigned int targetId, int targetAttachement, const QRect &targetRect)
Convenience methods to blit the results rendered in the internal FBO to a target.
~QVTKRenderWindowAdapter() override
QVTKRenderWindowAdapter(QOpenGLContext *cntxt, vtkGenericOpenGLRenderWindow *window, QWidget *parent)
Constructor that makes vtkGenericOpenGLRenderWindow ready for subsequent render requests i....
const QCursor & defaultCursor() const
Get/set the default cursor.
void setUnscaledDPI(int value)
Set the unscaled DPI to use when scaling DPI.
void setCustomDevicePixelRatio(double dpr)
Get/Set the custom device pixel ratio to use.
QOpenGLContext * context() const
Get the context to use for rendering.
void resize(int width, int height)
Call this method to resize the render window.
bool blit(unsigned int targetId, int targetAttachement, const QRect &targetRect, bool left=true)
Convenience methods to blit the results rendered in the internal FBO to a target.
bool handleEvent(QEvent *evt)
Process the event and return true if the event have been processed successfully.
bool blitRightEye(unsigned int targetId, int targetAttachement, const QRect &targetRect)
Convenience methods to blit the results rendered in the internal FBO to a target.
void paint()
Call this method in paintGL to request a render.
QVTKRenderWindowAdapter(QOpenGLContext *cntxt, vtkGenericOpenGLRenderWindow *window, QWindow *parent)
Constructor that makes vtkGenericOpenGLRenderWindow ready for subsequent render requests i....
void setEnableHiDPI(bool value)
Enable/disable DPI scaling.
void setDefaultCursor(const QCursor &cursor)
Get/set the default cursor.
platform independent render window
abstract base class for most VTK objects
Definition: vtkObject.h:73
@ value
Definition: vtkX3D.h:226
@ height
Definition: vtkX3D.h:260