VTK
9.1.0
|
Plugin class to expose a VTK C++ module to QML applications. More...
#include <QQmlVTKPlugin.h>
Inherits QQmlExtensionPlugin.
Public Member Functions | |
QQmlVTKPlugin ()=default | |
Constructor. | |
virtual | ~QQmlVTKPlugin ()=default |
Destructor. | |
void | registerTypes (const char *uri) |
Register QML types provided by VTK. | |
void | initializeEngine (QQmlEngine *engine, const char *uri) |
Initialize the extension using the QQmlEngine. | |
Protected Slots | |
void | cleanup () |
Destroy any singleton instances that were created during initializeEngine. | |
Plugin class to expose a VTK C++ module to QML applications.
QQmlVTKPlugin registers various VTK C++ classes as QML types so that QtQuick applications can directly import and use these types from QML.
As part of VTK's compilation process, it would compile and install a qmldir file that provides the module definition and relevant plugin information required by QML to load VTK. To load the plugin, set the environment variable QML2_IMPORT_PATH to the path of the directory containing the qmldir file.
Once the import path is set correctly, the module can be imported in the .qml file as follows:
The C++ classes exposed to QML and their associated typenames are as follows:
VTK C++ class | QML type |
---|---|
QQuickVTKRenderWindow | VTKRenderWindow |
QQuickVTKRenderItem | VTKRenderItem |
QQuickVTKInteractiveWidget | VTKWidget |
The VTK QML module follows the version number of the VTK source tree. For example, if compiled against VTK 9.0.x, the VTK module version will be 9.0
Definition at line 60 of file QQmlVTKPlugin.h.
|
default |
Constructor.
|
virtualdefault |
Destructor.
void QQmlVTKPlugin::registerTypes | ( | const char * | uri | ) |
Register QML types provided by VTK.
void QQmlVTKPlugin::initializeEngine | ( | QQmlEngine * | engine, |
const char * | uri | ||
) |
Initialize the extension using the QQmlEngine.
|
protectedslot |
Destroy any singleton instances that were created during initializeEngine.