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. How to iterate components dynamically using stackview?
Forum Updated to NodeBB v4.3 + New Features

How to iterate components dynamically using stackview?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 5 Posters 602 Views 2 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.
  • L Offline
    L Offline
    lakshmanGiri
    wrote on last edited by
    #1

    I wanted to know how to iterate between components dynamically using stackView. Let's say, I have an application window with five buttons. I wanted to show a small window within the application if I click any of the buttons. For Eg: There are five buttons and five components. Each button is associated with a component. These components are in stackVIew. If I click button 1, page 1 should appear within the application. Similarly, if I click button 2, page 2 should appear instead of page 1. I know this can be achieved using stackview, but I am unable to find the right solution for it.

    Can anyone help me, To achieve this?. Thanks in advance.

    ODБOïO ekkescornerE 2 Replies Last reply
    0
    • L lakshmanGiri

      I wanted to know how to iterate between components dynamically using stackView. Let's say, I have an application window with five buttons. I wanted to show a small window within the application if I click any of the buttons. For Eg: There are five buttons and five components. Each button is associated with a component. These components are in stackVIew. If I click button 1, page 1 should appear within the application. Similarly, if I click button 2, page 2 should appear instead of page 1. I know this can be achieved using stackview, but I am unable to find the right solution for it.

      Can anyone help me, To achieve this?. Thanks in advance.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @lakshmanGiri hi
      That is almost what the first example in the documentation does just use push and pop functions
      see also find and get https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html#finding-items

      1 Reply Last reply
      0
      • Poor EnglishP Offline
        Poor EnglishP Offline
        Poor English
        wrote on last edited by
        #3

        why not consider using QStackedWidget?as far as I know,QStackedWidget can perform similar functions as you mentioned,for example:you can place a QStackedWidget component in the UI of the application,and then insert several pages into it,if you want to switch these pages,just use simple【QStackedWidget::setCurrentIndex(para)】to set the page you want

        I am sorry about my poor English!

        jsulmJ 1 Reply Last reply
        0
        • Poor EnglishP Poor English

          why not consider using QStackedWidget?as far as I know,QStackedWidget can perform similar functions as you mentioned,for example:you can place a QStackedWidget component in the UI of the application,and then insert several pages into it,if you want to switch these pages,just use simple【QStackedWidget::setCurrentIndex(para)】to set the page you want

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Poor-English It's about QML here, not Qt Widgets.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          Poor EnglishP 1 Reply Last reply
          0
          • L lakshmanGiri

            I wanted to know how to iterate between components dynamically using stackView. Let's say, I have an application window with five buttons. I wanted to show a small window within the application if I click any of the buttons. For Eg: There are five buttons and five components. Each button is associated with a component. These components are in stackVIew. If I click button 1, page 1 should appear within the application. Similarly, if I click button 2, page 2 should appear instead of page 1. I know this can be achieved using stackview, but I am unable to find the right solution for it.

            Can anyone help me, To achieve this?. Thanks in advance.

            ekkescornerE Offline
            ekkescornerE Offline
            ekkescorner
            Qt Champions 2016
            wrote on last edited by
            #5

            @lakshmanGiri there's a (really outdated) example I made some years before about this while learning Qt and QML:
            https://github.com/ekke/stacked_pages_x
            https://appbus.wordpress.com/2016/05/27/stacked-pages-app/
            don't know if it's running out of the box but perhaps gives you some ideas

            BTW: this year I'll update all my examples and write new blogs while transform to Qt 5.15-->Qt6.2

            ekke ... Qt Champion 2016 | 2024 ... mobile business apps
            5.15 --> 6.9 https://t1p.de/ekkeChecklist
            QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

            1 Reply Last reply
            2
            • jsulmJ jsulm

              @Poor-English It's about QML here, not Qt Widgets.

              Poor EnglishP Offline
              Poor EnglishP Offline
              Poor English
              wrote on last edited by
              #6

              @jsulm
              Oh,I'm sorry!my English is not good,and I can't understand the partitions inside。In fact,I have to work hard to find the posts I have posted before,including pictures,so far I haven't figured out how to upload them。。。

              I am sorry about my poor English!

              jsulmJ 1 Reply Last reply
              0
              • Poor EnglishP Poor English

                @jsulm
                Oh,I'm sorry!my English is not good,and I can't understand the partitions inside。In fact,I have to work hard to find the posts I have posted before,including pictures,so far I haven't figured out how to upload them。。。

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Poor-English said in How to iterate components dynamically using stackview?:

                I have to work hard to find the posts I have posted before

                Simply go to your profile: on the upper right side click on your avatar icon and go to your profile.
                Image upload often does not work properly here. You can upload images to some sharing service and post the link then.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                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