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. Stack view problem
QtWS25 Last Chance

Stack view problem

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 1.4k 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.
  • E Offline
    E Offline
    eswar
    wrote on last edited by eswar
    #1

    Hi

    In my project, the 5 tab bar contain five different pages. Each page is created on the item container. I load the each page in the rectangle as stack view child item. If I run the program , the all the page will appear in the rectangle at first time. The initial page didn't appear first.

    sample code:
    StackView{
    id:stack
    anchors.fill: rect_stackview
    initialItem: page_first

            First{
                id:page_first
               //visible: false
            }
            Second{
                id:page_second
             //   visible: false
            }
           Third{
                id:page_third
               // visible: false
    
            }
            Fourth{
                id:page_fourth
           //     visible: false
            }
    

    If i put visible =false, the stackview is working fine, otherwise all the page appear in the rectangle. How can i solve this problem without set visible as false ?

    E 2 Replies Last reply
    0
    • E eswar

      Hi

      In my project, the 5 tab bar contain five different pages. Each page is created on the item container. I load the each page in the rectangle as stack view child item. If I run the program , the all the page will appear in the rectangle at first time. The initial page didn't appear first.

      sample code:
      StackView{
      id:stack
      anchors.fill: rect_stackview
      initialItem: page_first

              First{
                  id:page_first
                 //visible: false
              }
              Second{
                  id:page_second
               //   visible: false
              }
             Third{
                  id:page_third
                 // visible: false
      
              }
              Fourth{
                  id:page_fourth
             //     visible: false
              }
      

      If i put visible =false, the stackview is working fine, otherwise all the page appear in the rectangle. How can i solve this problem without set visible as false ?

      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      @eswar I suppose your sample code isn't copypasted, you have "initialItem: page_First" but " id:page_first" which doesn't work.

      E 1 Reply Last reply
      0
      • E Eeli K

        @eswar I suppose your sample code isn't copypasted, you have "initialItem: page_First" but " id:page_first" which doesn't work.

        E Offline
        E Offline
        eswar
        wrote on last edited by eswar
        #3

        @Eeli-K

        Hi

        oh sorry.. It just typo.. i edit some code...

        This is my problem
        If i put visible =false, the stackview is working fine, otherwise all the page appear in the rectangle. How can i solve this problem without setting visible as false ?

        1 Reply Last reply
        0
        • E eswar

          Hi

          In my project, the 5 tab bar contain five different pages. Each page is created on the item container. I load the each page in the rectangle as stack view child item. If I run the program , the all the page will appear in the rectangle at first time. The initial page didn't appear first.

          sample code:
          StackView{
          id:stack
          anchors.fill: rect_stackview
          initialItem: page_first

                  First{
                      id:page_first
                     //visible: false
                  }
                  Second{
                      id:page_second
                   //   visible: false
                  }
                 Third{
                      id:page_third
                     // visible: false
          
                  }
                  Fourth{
                      id:page_fourth
                 //     visible: false
                  }
          

          If i put visible =false, the stackview is working fine, otherwise all the page appear in the rectangle. How can i solve this problem without set visible as false ?

          E Offline
          E Offline
          Eeli K
          wrote on last edited by
          #4

          @eswar Can you create a minimal project which shows the problem? Just main.qml and two pages which can be run as-is with Qt Creator?

          1 Reply Last reply
          0
          • ibiaI Offline
            ibiaI Offline
            ibia
            wrote on last edited by
            #5

            You can do like this :

            Rectangle {
                id: baseComponent
            
                property Item first: Item { id: first_item }
                property Item second: Item { ... }
                property Item third: Item { ... }
                property Item fourth: Item { ... }
            
                StackView {
                    anchors.fill: parent
                    initialItem: first_item
                }
            }
            

            Hope it helped!

            E 1 Reply Last reply
            0
            • ibiaI ibia

              You can do like this :

              Rectangle {
                  id: baseComponent
              
                  property Item first: Item { id: first_item }
                  property Item second: Item { ... }
                  property Item third: Item { ... }
                  property Item fourth: Item { ... }
              
                  StackView {
                      anchors.fill: parent
                      initialItem: first_item
                  }
              }
              

              Hope it helped!

              E Offline
              E Offline
              eswar
              wrote on last edited by
              #6

              @ibia

              Hi

              Thanks for your reply . My issue solved.

              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