Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. navigation using page loader element
QtWS25 Last Chance

navigation using page loader element

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 2.0k 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.
  • A Offline
    A Offline
    Anas_Deshmukh
    wrote on last edited by
    #1

    Hello everyone i want to develope a code to navigate qml pages (eg. next and back).
    below is my test code.
    issue i am facing is once i go to "next" and "back", i again cant go to "next". along with my element on first qml is visible by setting property and cant controll mouse area "onclicked" as required.

    
    /// main.qml
    
    import QtQuick 1.1
    
    Rectangle {
        width: 360
        height: 360
    
        Loader {
            id : loader1
        }
    
        Rectangle {
            id : button1
            width: 100
            height: 50
            radius: 10
            focus: true
            color: "steelblue"
            anchors.horizontalCenter: parent.horizontalCenter
            y: 100
    
    
        Text {
            text: qsTr("next")
            anchors.centerIn: parent
        }
    
        MouseArea {
            anchors.fill: parent
            onClicked: {
                loader1.source="test.qml"
            }
        }
        }
    }
    
    /// test.qml
    
    import QtQuick 1.1
    
    Rectangle {
        width: 360
        height: 360
        color:  "red"
    
        Loader {
            id : loader1
        }
    
        Rectangle {
            width: 100
            height: 50
            radius: 10
            color: "steelblue"
            anchors.horizontalCenter: parent.horizontalCenter
            y: 200
    
        Text {
            text: qsTr("back")
            anchors.centerIn: parent
        }
    
        MouseArea {
            anchors.fill: parent
            onClicked: {
                loader1.source="main.qml"
            }
        }
        }
    }
    
    
    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @Anas_Deshmukh I guess the components are overlapping and hiding each other.

      157

      A 1 Reply Last reply
      0
      • p3c0P p3c0

        @Anas_Deshmukh I guess the components are overlapping and hiding each other.

        A Offline
        A Offline
        Anas_Deshmukh
        wrote on last edited by
        #3

        @p3c0 thanks for reply, Yes i was sure abt it, my elements getting overlapped (stil ltrying to fix it with adjustments). now my doubt is when loader load new page i think i messed up with "focus" property, ie. onMouseClicked, text input feild , tab navigation, and keyboard input key detect (unable to get input right now). Is there is any way when i load new page previous page properly hide and i can focus on element as my need. i read abt "binding" but little confuse on same approach.

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

          @Anas_Deshmukh Are you stuck with Qt Quick 1.x ? Can you move to latest version ?

          157

          A 1 Reply Last reply
          0
          • p3c0P p3c0

            @Anas_Deshmukh Are you stuck with Qt Quick 1.x ? Can you move to latest version ?

            A Offline
            A Offline
            Anas_Deshmukh
            wrote on last edited by
            #5

            @p3c0 No, i cant move to qt5,my code is part of opensource developement.(Qt 4.8.6)

            1 Reply Last reply
            0
            • A Anas_Deshmukh

              @p3c0 thanks for reply, Yes i was sure abt it, my elements getting overlapped (stil ltrying to fix it with adjustments). now my doubt is when loader load new page i think i messed up with "focus" property, ie. onMouseClicked, text input feild , tab navigation, and keyboard input key detect (unable to get input right now). Is there is any way when i load new page previous page properly hide and i can focus on element as my need. i read abt "binding" but little confuse on same approach.

              p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by p3c0
              #6

              @Anas_Deshmukh said in navigation using page loader element:

              Is there is any way when i load new page previous page properly hide and i can focus on element as my need. i read abt "binding" but little confuse on same approach.

              Perhaps you can bind the visible property of pages with Loader's status property i.e when status = Loader.Ready hide other one.
              Or it could be as trivial as hiding a page when you click a button to load other page.

              157

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Anas_Deshmukh
                wrote on last edited by
                #7

                Hi all,
                this issue is solve by adjusting 'focus' property and 'forceActiveFocus' in every loaded qml form.
                I use timer and onTriggered signal help me adjust focus in every loaded qml form.

                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