C

QML API changes

Removed QML types and features

Here is a list of removed QML types and modules

QML API or moduleAlternative
Qt Charts moduleThere is no replacement, but a workaround with static images can be used. The thermostat demo.
Javascript Date APICurrently there is no replacement.
toFixedInt()toFixed()
toExponentialAuto()toExponential()

Moved QulPerf

QulPerf has been moved to the Qt Quick Ultralite Extras QML module. You should now import the Qt Quick Ultralite Extras QML module to use it.

Qt for MCUs v1.9 and earlierQt for MCUs v2.0 and later
import QtQuick 2.15
Row {
    id: root
    visible: QulPerf.enabled

    PerformanceMetricItem {
        label: "FPS:"
        value: QulPerf.fps.toFixed(2)
    }
}
import QtQuick 2.15
import QtQuickUltralite.Extras 2.0
Row {
    id: root
    visible: QulPerf.enabled

    PerformanceMetricItem {
        label: "FPS:"
        value: QulPerf.fps.toFixed(2)
    }
}

JavaScript expressions in a ListElement

JavaScript expressions can no longer be bound with a property value in a ListElement. The ListElement now limits the possible values to constants and qsTr() / qsTrId() calls only. These changes are compatible with Qt.

Qt for MCUs v1.9 and earlierQt for MCUs v2.0 and later
ListModel {
    id: fruitModel

    ListElement {
        name: "Apple"
        cost: { 5 + 10 }
    }
    ListElement {
        name: "Orange"
        cost: 3.25
    }
}
ListModel {
    id: fruitModel

    ListElement {
        name: "Apple"
        cost: 15
    }
    ListElement {
        name: "Orange"
        cost: 3.25
    }
}

Item margins in AnchorChanges

AnchorChanges can no longer be used to modify the margins of an item. Use PropertyChanges instead.

Qt for MCUs v1.9 and earlierQt for MCUs v2.0 and later
AnchorChanges {
    target: myRect
    anchors {
        top: anchorRectEnd.top
        bottom: anchorRectEnd.bottom
        left: anchorRectEnd.left
        right: anchorRectEnd.right
        topMargin: 20
        bottomMargin: 20
        leftMargin: 20
        rightMargin: 20
    }
}
AnchorChanges {
    target: myRectanchors {
        top: anchorRectEnd.top
        bottom: anchorRectEnd.bottom
        left: anchorRectEnd.left
        right: anchorRectEnd.right
    }
}
PropertyChanges {
    target: myRect
    anchors {
        topMargin: 20
        bottomMargin: 20
        leftMargin: 20
        rightMargin: 20
    }
}

Text alignment

The enumeration values for horizontalAlignment and verticalAlignment properties have been unified for both Text and StaticText items. These types now use the Text.horizontalAlignment and Text.verticalAlignment values instead.

Qt for MCUs v1.9 and earlierQt for MCUs v2.0 and later
StaticText {
    horizontalAlignment: StaticText.AlignRight
    verticalAlignment: StaticText.AlignVCenter
    text: "right aligned"
}
StaticText {
    horizontalAlignment: Text.AlignRight
    verticalAlignment: Text.AlignVCenter
    text: "right aligned"
}

Limit Font.unicodeCoverage usage

The font.unicodeCoverage property is supported in Qt.font() context only.

Qt for MCUs v1.9 and earlierQt for MCUs v2.0 and later
Text {
    font.unicodeCoverage: [Font.UnicodeBlock_BasicLatin]
}
Text {
    font: Qt.font({ unicodeCoverage: [Font.UnicodeBlock_BasicLatin]})
}

Available under certain Qt licenses.
Find out more.