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. Manage QML pages from c++
Forum Updated to NodeBB v4.3 + New Features

Manage QML pages from c++

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 2 Posters 947 Views 1 Watching
  • 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.
  • D Offline
    D Offline
    Delta_sim
    wrote on last edited by
    #1

    Hello everyone,

    I'm starting a new Qt Quick application and I would like to control QML pages (items) from a class c++.

    Let me explain, I would like to develop a model-view-controller application with the model and controller in c++ and only the view in QML.
    But I don't know what's the best way to do it.

    In the past I used QWidget : I put all my QWidget pages in a QStackedLayout and I changed the current index to switch between pages. And I would like to reproduce this mechanism but with QML pages.

    Have you done that before ?
    Can you help me to design my application ?

    Thank you

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Good. You can do all that. Just check SwipeView component.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      1
      • D Offline
        D Offline
        Delta_sim
        wrote on last edited by
        #3

        Ok, I also saw StackLayout in QML, I think I can use it.
        But how can I change the currentIndex of this QML component in c++ ?
        I mean, what is the best way ?

        Thank you

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Best way is to make it declarative. You can define currentIndex as Q_PROPERTY inside the QObject class and expose it.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Delta_sim
            wrote on last edited by
            #5

            Ok great, thanks for your help !

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Delta_sim
              wrote on last edited by
              #6

              Just another question, I have a big database (around 100 variables). Is it safe to use 100 Q_PROPERTY ? To use the database from QML.
              Thanks

              1 Reply Last reply
              0
              • dheerendraD Offline
                dheerendraD Offline
                dheerendra
                Qt Champions 2022
                wrote on last edited by
                #7

                I suggest you to close this issue and open another issue. So that it helps others who are looking for similar question.

                Dheerendra
                @Community Service
                Certified Qt Specialist
                http://www.pthinks.com

                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