QWidget for displaying a vtkRenderWindow in a Qt Application. More...
#include <QVTKOpenGLWidget.h>
Signals | |
void | mouseEvent (QMouseEvent *event) |
void | resized () |
void | widgetEvent (QEvent *e) |
Public Member Functions | |
virtual bool | enableHiDPI () |
virtual vtkRenderWindowInteractor * | GetInteractor () |
virtual QVTKInteractorAdapter * | GetInteractorAdapter () |
virtual vtkRenderWindow * | GetRenderWindow () |
QImage | grabFramebuffer () |
virtual bool | isValid () |
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()) | |
virtual void | setEnableHiDPI (bool enable) |
void | setFormat (const QSurfaceFormat &format) |
void | setQVTKCursor (const QCursor &cursor) |
void | SetRenderWindow (vtkGenericOpenGLRenderWindow *win) |
void | SetRenderWindow (vtkRenderWindow *win) |
virtual bool | testingEvent (QEvent *e) |
~QVTKOpenGLWidget () override | |
Static Public Member Functions | |
static QSurfaceFormat | defaultFormat () |
Protected Member Functions | |
virtual bool | event (QEvent *e) Q_DECL_OVERRIDE |
virtual void | resizeEvent (QResizeEvent *event) Q_DECL_OVERRIDE |
Protected Attributes | |
bool | EnableHiDPI = true |
Private Types | |
typedef QWidget | Superclass |
Private Slots | |
void | windowEvent (QEvent *event) |
Private Attributes | |
QVTKOpenGLWindow * | qVTKOpenGLWindowInternal |
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.
|
private |
Definition at line 87 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 |
|
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
.
|
inlinevirtual |
Definition at line 136 of file QVTKOpenGLWidget.h.
|
protectedvirtual |
|
virtual |
Get the VTK render window interactor from the internal QVTKOpenGLWindow.
|
virtual |
Get the QEvent to VTK events translator.
|
virtual |
Get the VTK render window from the internal QVTKOpenGLWindow.
QImage QVTKOpenGLWidget::grabFramebuffer | ( | ) |
Expose internal QVTKOpenGLWindow::grabFramebuffer(). Renders and returns a 32-bit RGB image of the framebuffer.
|
virtual |
Returns true if the internal QOpenGLWindow's is valid, i.e. if OpenGL resources, like the context, have been successfully initialized.
|
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.
|
protectedvirtual |
|
virtual |
Enable or disable support for HiDPI displays.
void QVTKOpenGLWidget::setFormat | ( | const QSurfaceFormat & | format | ) |
Set the QSurfaceFormat used to create the OpenGL context.
void QVTKOpenGLWidget::setQVTKCursor | ( | const QCursor & | cursor | ) |
Set the cursor on this widget.
void QVTKOpenGLWidget::SetRenderWindow | ( | vtkGenericOpenGLRenderWindow * | win | ) |
Set the VTK render window for the internal QVTKOpenGLWindow.
void QVTKOpenGLWidget::SetRenderWindow | ( | vtkRenderWindow * | win | ) |
|
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.
|
signal |
Forward events to the internal QVTK window.
|
privateslot |
called as a response to QVTKOpenGLWindow::event
to forward the signal.
|
protected |
Definition at line 191 of file QVTKOpenGLWidget.h.
|
private |
Definition at line 194 of file QVTKOpenGLWidget.h.