C

How to keep compatibility 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 StaticText

To reuse Qt Quick Ultralite code that uses StaticText with Qt Quick, add the following dummy StaticText.qml to your Qt Quick project.

Text {
}

Using ColorizedImage

ColorizedImage provides color overlay effects for images. To use this item in Qt Quick, add your own ColorizedImage.qml implementation as shown in the following example:

Image {
    id: img
    property var color: "transparent"
    layer.enabled: true
    layer.effect: ColorOverlay {
        anchors.fill: img
        source: img
        color: img.color
    }
}

Using Qul.image()

Qt Quick does not provide Qul object. To reuse Qt Quick Ultralite code that uses Qul::image() with Qt Quick, add the following dummy Qul.qml to your Qt Quick project.

pragma Singleton
import QtQml 2.0

QtObject {
    function image(filepath) {
        return filepath
    }
}

Note: Qul::image will be removed in future versions of Qt Quick Ultralite.

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.

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

Available under certain Qt licenses.
Find out more.