Important: Please read the Qt Code of Conduct -

Invalid property name "states" (M16).

  • Quite new to Qt5 programming I tried getting some feeling for QML and Qt Quick by following one of the embedded tutorials in Qt Creator on the subject.
    But when asked to add states in QMLDesigner by clicking the "+" sign I instantly got the error message "Invalid property name "states" (M16)." and no states are added. So I effectively cannot use QtQuick. I tried adding them manually to the QML file itself, but then they dont show up in de designer either.
    What am I doing wrong if anything?

    Windows 10 - Qt Creator 4.13.0 - Qt 5.15.0 - building for MSVC 19 64 bit.

  • Solved. I already found that I was using a Window type which indeed does not have a "states" property.
    Would have liked another message to tell me that though.

  • In the Qt tutorial said that:

    Qt Creator generates a QML file, main.qml, and opens it in Text Editor. The wizard template uses the Window type, which does not support adding states. Because we want to use states in this example, we first replace the Window type with a Rectangle type. We must also remove the line that sets the title property, which the Rectangle type does not have. If you change the value of the Type property in the Properties view, Qt Creator offers to automatically remove the title property.

Log in to reply