VTK
|
QWidget for displaying a vtkRenderWindow in a Qt Application. More...
#include <QVTKOpenGLWidget.h>
Inherits QWidget.
Signals | |
void | mouseEvent (QMouseEvent *event) |
This signal will be emitted whenever a mouse event occurs within the QVTK window. More... | |
void | resized () |
This signal will be emitted whenever a resize event occurs within the QVTK window. More... | |
void | widgetEvent (QEvent *e) |
Forward events to the internal QVTK window. More... | |
Public Member Functions | |
QVTKOpenGLWidget (QWidget *parent=Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags()) | |
QVTKOpenGLWidget (QOpenGLContext *shareContext, QWidget *parent=Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags()) | |
QVTKOpenGLWidget (vtkGenericOpenGLRenderWindow *w, QWidget *parent=Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags()) | |
QVTKOpenGLWidget (vtkGenericOpenGLRenderWindow *w, QOpenGLContext *shareContext, QWidget *parent=Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags()) | |
~QVTKOpenGLWidget () override | |
void | SetRenderWindow (vtkGenericOpenGLRenderWindow *win) |
Set the VTK render window for the internal QVTKOpenGLWindow. More... | |
void | SetRenderWindow (vtkRenderWindow *win) |
virtual vtkRenderWindow * | GetRenderWindow () |
Get the VTK render window from the internal QVTKOpenGLWindow. More... | |
virtual vtkRenderWindowInteractor * | GetInteractor () |
Get the VTK render window interactor from the internal QVTKOpenGLWindow. More... | |
virtual QVTKInteractorAdapter * | GetInteractorAdapter () |
Get the QEvent to VTK events translator. More... | |
void | setFormat (const QSurfaceFormat &format) |
Set the QSurfaceFormat used to create the OpenGL context. More... | |
virtual void | setEnableHiDPI (bool enable) |
Enable or disable support for HiDPI displays. More... | |
virtual bool | enableHiDPI () |
void | setQVTKCursor (const QCursor &cursor) |
Set the cursor on this widget. More... | |
virtual bool | isValid () |
Returns true if the internal QOpenGLWindow's is valid, i.e. More... | |
virtual bool | testingEvent (QEvent *e) |
Forward events to the internal QVTKOpenGLWindow when events are explicitly sent to the widget. More... | |
QImage | grabFramebuffer () |
Expose internal QVTKOpenGLWindow::grabFramebuffer(). More... | |
Static Public Member Functions | |
static QSurfaceFormat | defaultFormat () |
Returns a typical QSurfaceFormat suitable for most applications using QVTKOpenGLWidget. More... | |
Protected Member Functions | |
virtual void | resizeEvent (QResizeEvent *event) Q_DECL_OVERRIDE |
virtual bool | event (QEvent *e) Q_DECL_OVERRIDE |
Protected Attributes | |
bool | EnableHiDPI = true |
QWidget for displaying a vtkRenderWindow in a Qt Application.
QVTKOpenGLWidget is a QWidget wrapper around QVTKOpenGLWindow. It holds a pointer to an internal QVTKOpenGLWindow instance in order to display VTK data in a Qt OpenGL context.
It was designed to support quad buffer stereo rendering.
A typical usage for QVTKOpenGLWidget is as follows:
External calls requesting the render window to render might not be safe. Please make sure that QVTKOpenGLWidget::isValid() returns true before making explicit call to vtkGenericOpenGLRenderWindow::Render(). An alternative is to call update() on the widget instance to trigger a render once the context gets validated;
QVTKOpenGLWidget is compatible with Qt version 5.6 and above, but it is mainly tested on Qt 5.9 and above.
Due to Qt limitations, QVTKOpenGLWidget does not support being a native widget. But native widget are sometimes mandatory, for example within QScrollArea and QMDIArea, so the QVTKOpenGLNativeWidget should be used when in needs of VTK rendering in the context of Qt native widget.
If a QVTKOpenGLWidget is used in a QScrollArea or in a QMDIArea, it will force it to be native and this is NOT supported.
Definition at line 84 of file QVTKOpenGLWidget.h.
QVTKOpenGLWidget::QVTKOpenGLWidget | ( | QWidget * | parent = Q_NULLPTR , |
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
QVTKOpenGLWidget::QVTKOpenGLWidget | ( | QOpenGLContext * | shareContext, |
QWidget * | parent = Q_NULLPTR , |
||
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
QVTKOpenGLWidget::QVTKOpenGLWidget | ( | vtkGenericOpenGLRenderWindow * | w, |
QWidget * | parent = Q_NULLPTR , |
||
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
QVTKOpenGLWidget::QVTKOpenGLWidget | ( | vtkGenericOpenGLRenderWindow * | w, |
QOpenGLContext * | shareContext, | ||
QWidget * | parent = Q_NULLPTR , |
||
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
|
override |
void QVTKOpenGLWidget::SetRenderWindow | ( | vtkGenericOpenGLRenderWindow * | win | ) |
Set the VTK render window for the internal QVTKOpenGLWindow.
void QVTKOpenGLWidget::SetRenderWindow | ( | vtkRenderWindow * | win | ) |
|
virtual |
Get the VTK render window from the internal QVTKOpenGLWindow.
|
virtual |
Get the VTK render window interactor from the internal QVTKOpenGLWindow.
|
virtual |
Get the QEvent to VTK events translator.
|
static |
Returns a typical QSurfaceFormat suitable for most applications using QVTKOpenGLWidget.
Note that this is not the QSurfaceFormat that gets used if none is specified. That is set using QSurfaceFormat::setDefaultFormat
.
void QVTKOpenGLWidget::setFormat | ( | const QSurfaceFormat & | format | ) |
Set the QSurfaceFormat used to create the OpenGL context.
|
virtual |
Enable or disable support for HiDPI displays.
|
inlinevirtual |
Definition at line 136 of file QVTKOpenGLWidget.h.
void QVTKOpenGLWidget::setQVTKCursor | ( | const QCursor & | cursor | ) |
Set the cursor on this widget.
|
virtual |
Returns true if the internal QOpenGLWindow's is valid, i.e.
if OpenGL resources, like the context, have been successfully initialized.
|
virtual |
Forward events to the internal QVTKOpenGLWindow when events are explicitly sent to the widget.
This is required due to QTBUG-61836 that prevents the use of the flag Qt::TransparentForMouseInput. This flag indicates that the internal window let events pass through. When this misbehavior gets fixed, events will be forwarded to this widget's event() callback, that will then forward them back to the window.
QImage QVTKOpenGLWidget::grabFramebuffer | ( | ) |
Expose internal QVTKOpenGLWindow::grabFramebuffer().
Renders and returns a 32-bit RGB image of the framebuffer.
|
signal |
This signal will be emitted whenever a mouse event occurs within the QVTK window.
|
signal |
This signal will be emitted whenever a resize event occurs within the QVTK window.
|
signal |
Forward events to the internal QVTK window.
|
protectedvirtual |
|
protectedvirtual |
|
protected |
Definition at line 191 of file QVTKOpenGLWidget.h.