How to keep compatibility between Qt Quick Ultralite and Qt Quick

Qt Quick Ultralite is a subset of Qt Quick, therefore Qt Quick Ultralite source code by definition is compatible with Qt Quick. This topic lists all known exceptions and how to keep the code compatible with Qt Quick.

Using Qt Quick Ultralite specific QML objects

To reuse Qt Quick Ultralite code with QML objects that are not supported by QtQuick, such as StaticText or ColorizedImage, see Reusing Qt Quick Ultralite QML objects with Qt QML.

Import statements and version numbers

Unlike Qt Quick, which requires a version number against the import statement, Qt Quick Ultralite ignores version number in the import statement. It always imports the latest version of the module. To write qml that is compatible with Qt Quick, the version number must not be omitted. To ensure your code will be syntax-compatible with Qt Quick use least Qt 5.15.

enum type as a property type

Using an enum as the property type is not supported in Qt Quick. To write compatible code, use the int type instead.

The following example is not compatible with Qt Quick:

enum Menu { MediaPlayerMenu, NavigationMenu, PhoneMenu, CarStatusMenu, MenuCount }
property NormalModeModel.Menu menu: NormalModeModel.MediaPlayerMenu

To make it portable, you must replace the last line with the following one:

property int menu: NormalModeModel.MediaPlayerMenu

Using the ListModel<T> QML type

While the ListModel<T> property type can be used to specify model structure without providing the model data, it is not supported in Qt Quick.

To make the code compatible with Qt Quick, replace the ListModel<T> type with var.

Available under certain Qt licenses.
Find out more.