Nominate our 2022 Qt Champions!

Is IDE capable of warning about mistakes in qml file?

  • Hello guys,

    This is my first day with Qt, I've tried to write first application based on the example:

    Everything seemed working until the last steps of tutorial. After clicking on one of the rectangles, the icon should change its position but it hasn't worked for me. Here is the example code for one of the rectangles:

        Rectangle {
            id: bottomLeftRect
            width: 44
            height: 44
            color: "#00000000"
            radius: 6
            border.width: 1
            anchors.left: parent.left
            anchors.leftMargin: 10
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 20
            MouseArea {
                id: mouseArea3
                anchors.fill: parent
                onClicked: StateGroup.state = 'State2'
        StateGroup {
               id: stateGroup
               states: [
                   State {
                       name: "State1"
                       PropertyChanges {
                           target: icon
                           x: middleRightRect.x
                           y: middleRightRect.y
                   State {
                       name: "State2"
                       PropertyChanges {
                           target: icon
                           x: bottomLeftRect.x
                           y: bottomLeftRect.y

    After spending a quite a lot of time I figured out where the problem is:

                onClicked: StateGroup.state = 'State2'

    I've entered a bad identifier name, it should be "stateGroup".

    Why IDE hasn't warned me about this error during build process? I've discovered that I can write a lot of nonesense in this file and IDE is silent about this. Can I do something about this because in its current state it is quite hard to develop an application by somone new to Qt.

    I am using an opoen source Qt Creator 3.5.1

    Thank you for your time.

  • Really no answer? I would thought that this is a pretty basic question...

  • Lifetime Qt Champion


    You can use CTRL+SHIFT+C to run checks on your QML.

Log in to reply