Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Quick - multi state home screen - embedded linux
QtWS25 Last Chance

Qt Quick - multi state home screen - embedded linux

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 2 Posters 1.7k Views
  • 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.
  • M Offline
    M Offline
    marcin100
    wrote on last edited by
    #1

    Hi,

    I'm trying to implement GUI similar to Android home screen - the one with multiple screens.
    Except much simpler. Each screen/state would be just a Rectangle with some dynamic text updated from C++ code.
    There will be row of control buttons at the bottom which will activate certain screen/rectangle. Animation will be used but I have not decided on slide vs zoom/fade

    What is a better way of implementing such interface. Should I use states or just have all rectangels on top of eachother and modify opacity/visibility?

    I think visually I can achieve it either way, but I am wondering about the resources, processor load and speed since this will run on embedded linux device.

    What happens when object's visiblity is set to false vs when the object is in the non-active state?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      Did you check "StackView":http://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html ? I guess it would be more suitable.

      Qt Quick 2 makes use of a dedicated scene graph based on OpenGL ES 2.0 or OpenGL 2.0 which would use GPU for calculations and thus speed up rendering. The remaining load will be taken up by the CPU as usual.

      bq. What happens when object’s visiblity is set to false vs when the object is in the non-active state?

      AFAIK (in terms of rendering) setting visibility to false will not render that element until it is made visible and in latter case it will atleast be rendered.

      157

      1 Reply Last reply
      0
      • M Offline
        M Offline
        marcin100
        wrote on last edited by
        #3

        Thank you for the suggestion. I just came across the StackView 5 min before reading your post. I need to read about it first.

        However I have already implemented this using Loader element. To do this I had to create separate QML files for each rectangle and they get dynamically loaded or destroyed by using the following code:

        @
        Loader
        {
        id: homeScreenLoader
        anchors.fill: parent
        source: "default_screen.qml" // only needed if you want something loaded on startup

            }
        

        @

        And then each control button will have this line inside the Mouse Area:

        @
        onClicked:
        {
        centerLoader.source = "qml_file_name.qml"
        }
        @
        This way only the loaded rectagle is taking up the memory (I think).

        I still have a slight issue with controlling the animation (not related to this post) but the reason I do not mark it as SOLVED is because I'm interested in opinions on this approach. Thanks in advance.

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Your way is also correct but in this way you will need manage everything for eg. creating, loading, deleting etc.. With StackView you get the readymade methods to do those. Also it provides Transitions animations. Moreover if you dont require any Item you can just pop it. Setting destroyOnPop to true will destroy the Item when popped.

          157

          1 Reply Last reply
          0
          • M Offline
            M Offline
            marcin100
            wrote on last edited by
            #5

            Thank you.

            Coming back to the "Loader":http://doc.qt.io/qt-5/qml-qtquick-loader.html QML Type, I have read this:

            bq. If the source or sourceComponent changes, any previously instantiated items are destroyed. Setting source to an empty string or setting sourceComponent to undefined destroys the currently loaded object, freeing resources and leaving the Loader empty.

            If I understand this correctly then the Loader takes care of destroying the unused objects and all that needs to be done is just load a new object on button click.

            Please confirm if my understanding is correct.

            Also anyone else has the opinion on "Loader":http://doc.qt.io/qt-5/qml-qtquick-loader.html vs "StackView":http://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html?

            1 Reply Last reply
            0
            • p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by
              #6

              bq. If I understand this correctly then the Loader takes care of destroying the unused objects and all that needs to be done is just load a new object on button click.

              Correct. But only those which are loaded by Loader.

              157

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved