QtQuick 2.2 and states
bejronix last edited by
I try to write simple window with few states and when i try to set Rectangle or Item element as root instead of default Window element application doesn't open. In Qt Designer I can manipulate states panel then and preview looks nice.
When I set Window element as root I get error that Window element doesn't contains states property so I put Rectangle one level below Window, setted it states and it works good, but unfortunately I can't manipulate into states panel in Designer (I can't even see any states besides default there).
How can I make this in the newest version?
There are several ways you can run a QML app, but mixing them is not supported. Qt Creator's default template uses Window by default, but you can change this. Here is how:
Change Window to Rectangle, like you've already tried
In c++ code, use QQuickView class to display your QML file
An alternative would be to leave everything as-is, and just add a root Rectangle element (that is, add a rectangle to Window, make use anchors.fill = parent), and handle states there.