VTK
9.0.3
|
QWidget for displaying a vtkRenderWindow in a Qt Application. More...
#include <QVTKOpenGLStereoWidget.h>
Inherits QWidget.
Public Member Functions | |
QVTKOpenGLStereoWidget (QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
QVTKOpenGLStereoWidget (QOpenGLContext *shareContext, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
QVTKOpenGLStereoWidget (vtkGenericOpenGLRenderWindow *w, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
QVTKOpenGLStereoWidget (vtkGenericOpenGLRenderWindow *w, QOpenGLContext *shareContext, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
~QVTKOpenGLStereoWidget () override | |
void | setRenderWindow (vtkGenericOpenGLRenderWindow *win) |
Set a render window to use. More... | |
void | setRenderWindow (vtkRenderWindow *win) |
vtkRenderWindow * | renderWindow () const |
Returns the render window that is being shown in this widget. More... | |
QVTKInteractor * | interactor () const |
Get the QVTKInteractor that was either created by default or set by the user. More... | |
void | setEnableHiDPI (bool enable) |
Enable or disable support for HiDPI displays. More... | |
bool | enableHiDPI () const |
void | setUnscaledDPI (int dpi) |
Set/Get unscaled DPI value. More... | |
int | unscaledDPI () const |
void | setDefaultCursor (const QCursor &cursor) |
Set/get the default cursor to use for this widget. More... | |
const QCursor & | defaultCursor () const |
bool | isValid () |
Returns true if the internal QOpenGLWindow's is valid, i.e. More... | |
QImage | grabFramebuffer () |
Expose internal QVTKOpenGLWindow::grabFramebuffer(). More... | |
QVTKOpenGLWindow * | embeddedOpenGLWindow () const |
Returns the embedded QVTKOpenGLWindow. More... | |
void | setFormat (const QSurfaceFormat &fmt) |
Sets the requested surface format. More... | |
QSurfaceFormat | format () const |
Returns the context and surface format used by this widget and its toplevel window. More... | |
void | SetRenderWindow (vtkGenericOpenGLRenderWindow *win) |
void | SetRenderWindow (vtkRenderWindow *win) |
vtkRenderWindow * | GetRenderWindow () |
These methods have be deprecated to fix naming style. More... | |
QVTKInteractor * | GetInteractor () |
QVTKInteractorAdapter * | GetInteractorAdapter () |
void | setQVTKCursor (const QCursor &cursor) |
void | setDefaultQVTKCursor (const QCursor &cursor) |
Static Public Member Functions | |
static QSurfaceFormat | defaultFormat (bool stereo_capable=false) |
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering. More... | |
Protected Member Functions | |
void | resizeEvent (QResizeEvent *evt) override |
void | paintEvent (QPaintEvent *evt) override |
QWidget for displaying a vtkRenderWindow in a Qt Application.
QVTKOpenGLStereoWidget simplifies using a QVTKOpenGLWindow as a widget in Qt application so it can be embedded in a layout rather than being a top-level window. QVTKOpenGLWindow has all the limitations posed by Qt with QWidget::createWindowContainer
hence developers are advised to refer to Qt docs for more details.
In general QVTKOpenGLNativeWidget may be a better choice, however QVTKOpenGLWindow-based QVTKOpenGLStereoWidget may be better choice for applications requiring quad-buffer stereo.
Due to Qt limitations, QVTKOpenGLStereoWidget 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 QVTKOpenGLStereoWidget is used in a QScrollArea or in a QMDIArea, it will force it to be native and this is NOT supported.
Unlike QVTKOpenGLNativeWidget, QVTKOpenGLStereoWidget does not require that the default surface format for the application be changed. One can simply specify the needed QSurfaceFormat for the specific QVTKOpenGLStereoWidget instance by calling QVTKOpenGLStereoWidget::setFormat
before the widget is initialized.
Definition at line 64 of file QVTKOpenGLStereoWidget.h.
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget | ( | QWidget * | parent = nullptr , |
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget | ( | QOpenGLContext * | shareContext, |
QWidget * | parent = nullptr , |
||
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget | ( | vtkGenericOpenGLRenderWindow * | w, |
QWidget * | parent = nullptr , |
||
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
QVTKOpenGLStereoWidget::QVTKOpenGLStereoWidget | ( | vtkGenericOpenGLRenderWindow * | w, |
QOpenGLContext * | shareContext, | ||
QWidget * | parent = nullptr , |
||
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
|
override |
|
inline |
Set a render window to use.
It a render window was already set, it will be finalized and all of its OpenGL resource released. If the win
is non-null and it has no interactor set, then a QVTKInteractor instance will be created as set on the render window as the interactor.
Definition at line 83 of file QVTKOpenGLStereoWidget.h.
|
inline |
Definition at line 87 of file QVTKOpenGLStereoWidget.h.
|
inline |
Returns the render window that is being shown in this widget.
Definition at line 93 of file QVTKOpenGLStereoWidget.h.
|
inline |
Get the QVTKInteractor that was either created by default or set by the user.
Definition at line 98 of file QVTKOpenGLStereoWidget.h.
|
inlinestatic |
Returns a QSurfaceFormat suitable for surfaces that intend to be used for VTK rendering.
If your applications plans on using QVTKOpenGLNativeWidget
, then this format (or similar) must be set as the default format on QSurfaceFormat before any widgets are created.
Note this returns a QSurfaceFormat required to support the OpenGL rendering capabilities in a vtkRenderWindow. Whether those features, e.g. multi sampling, is actually used for rendering is determined by values specified on the vtkRenderWindow instance itself through appropriate API.
Passing stereo_capable=true
is same as calling QSurfaceFormat::setStereo(true)
. This is necessary if you want to use quad-buffer based stereo in your application.
Refer to Qt docs for QOpenGLWidget and QOpenGLWindow for appropriate locations in your application where to the format may be provided e.g. either on the instance of QOpenGLWindow or QOpenGLWidget subclasses or as default format for the application using QSurfaceFormat::setDefaultFormat()
.
Definition at line 103 of file QVTKOpenGLStereoWidget.h.
|
inline |
Enable or disable support for HiDPI displays.
When enabled, this enabled DPI scaling i.e. vtkWindow::SetDPI
will be called with a DPI value scaled by the device pixel ratio every time the widget is resized. The unscaled DPI value can be specified by using setUnscaledDPI
.
Definition at line 111 of file QVTKOpenGLStereoWidget.h.
|
inline |
Definition at line 112 of file QVTKOpenGLStereoWidget.h.
|
inline |
Set/Get unscaled DPI value.
Defaults to 72, which is also the default value in vtkWindow.
Definition at line 119 of file QVTKOpenGLStereoWidget.h.
|
inline |
Definition at line 120 of file QVTKOpenGLStereoWidget.h.
|
inline |
Set/get the default cursor to use for this widget.
Definition at line 127 of file QVTKOpenGLStereoWidget.h.
|
inline |
Definition at line 128 of file QVTKOpenGLStereoWidget.h.
|
inline |
Returns true if the internal QOpenGLWindow's is valid, i.e.
if OpenGL resources, like the context, have been successfully initialized.
Definition at line 135 of file QVTKOpenGLStereoWidget.h.
QImage QVTKOpenGLStereoWidget::grabFramebuffer | ( | ) |
Expose internal QVTKOpenGLWindow::grabFramebuffer().
Renders and returns a 32-bit RGB image of the framebuffer.
|
inline |
Returns the embedded QVTKOpenGLWindow.
Definition at line 146 of file QVTKOpenGLStereoWidget.h.
|
inline |
Sets the requested surface format.
When the format is not explicitly set via this function, the format returned by QSurfaceFormat::defaultFormat() will be used. This means that when having multiple OpenGL widgets, individual calls to this function can be replaced by one single call to QSurfaceFormat::setDefaultFormat() before creating the first widget.
Definition at line 157 of file QVTKOpenGLStereoWidget.h.
|
inline |
Returns the context and surface format used by this widget and its toplevel window.
Definition at line 162 of file QVTKOpenGLStereoWidget.h.
void QVTKOpenGLStereoWidget::SetRenderWindow | ( | vtkGenericOpenGLRenderWindow * | win | ) |
void QVTKOpenGLStereoWidget::SetRenderWindow | ( | vtkRenderWindow * | win | ) |
vtkRenderWindow* QVTKOpenGLStereoWidget::GetRenderWindow | ( | ) |
These methods have be deprecated to fix naming style.
Since QVTKOpenGLNativeWidget is QObject subclass, we follow Qt naming conventions rather than VTK's.
QVTKInteractor* QVTKOpenGLStereoWidget::GetInteractor | ( | ) |
QVTKInteractorAdapter* QVTKOpenGLStereoWidget::GetInteractorAdapter | ( | ) |
Hence the API was removed.
void QVTKOpenGLStereoWidget::setQVTKCursor | ( | const QCursor & | cursor | ) |
Simply use QWidget::setCursor
API to change cursor.
void QVTKOpenGLStereoWidget::setDefaultQVTKCursor | ( | const QCursor & | cursor | ) |
Use setDefaultCursor
instead.
|
overrideprotected |
|
overrideprotected |