Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QtQuick 2.2 and states

    QML and Qt Quick
    2
    2
    489
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bejronix last edited by

      Hi,

      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?

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        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.

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • First post
          Last post