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.