C
Reusing Qt Quick Ultralite QML objects with Qt QML
Qt Quick Ultralite's Qt QML compatibility modules
Qt Quick Ultralite provides compatibility modules to let you use Qt Quick Ultralite QML objects with Qt QML. The modules are located in <Qul install directory>/compatibility
.
Qt Quick Ultralite offers the following compatibility modules:
Name | Minimum version |
---|---|
Extras | 1.0 |
Layers | 1.7 |
StudioComponents | 2.7 |
Note: Every module can be imported with the minor version number of the currently installed package.
To use any of the modules one must add the <Qul install directory>/compatibility
directory to the QML import path and import the desired module in the .qml
file:
Note: The modules require Qt 6.2
.
Import the Qt Quick Ultralite Extras, Qt Quick Ultralite Layers, or Qt Quick Ultralite Studio Components module.
// sample main.cpp file ... int main(int argc, char *argv[]) { ... QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.addImportPath("<Qul install directory>/compatibility"); ... return app.exec(); }
// sample main.qml file import QtQuick 2.15 ... import QtQuickUltralite.Extras 2.10.0 Window { ... StaticText { text: "Hello World!" } }
Note: The Extras
module uses C++ and therefore the module's binaries must match with the user's project configuration.
To take advantage of Qt Creator's code completion, append the <Qul install directory>/compatibility
directory to the QML_IMPORT_PATH.
Building
The Qt Quick Ultralite source package provides sources for the modules, which are located in QUL_DIR/compatibility/QtQuickUltralite/*
If the provided binaries don't match your project configuration, you can build the library with the desired settings.
The package contains a CMakeLists.txt
file that builds the modules. To build the Extras
module execute the QtQuickUltraliteExtras
CMake target. The default output location is set to the CMAKE_BINARY_DIR
CMake variable and can be changed by setting the QUL_COMPATIBILITY_MODULE_DIR
CMake variable.
To automate the process you can add_subdirectory of the CMakeLists.txt
:
set(QUL_COMPATIBILITY_DIR ${<Qul install directory>}/compatibility) add_subdirectory(${QUL_COMPATIBILITY_DIR} ${CMAKE_BINARY_DIR}/compatibility)
Then add a dependency to your target:
add_dependencies(my_target QtQuickUltraliteExtras)
See also StaticText, ColorizedImage, AnimatedSpriteDirectory, QulPerf, ItemLayer, ImageLayer, SpriteLayer, ApplicationScreens, Screen, and ArcItem.
Available under certain Qt licenses.
Find out more.