Page navigation and Text input focus



  • hello everyone,
    my aim is to get user keyboard input using "textInput" in main.qml then navigate to "1.qml" using loader, get some other text input and get back to main.qml.

    but after running my code everything is overlapped andnot navigating properly

    // main.qml
    
    import QtQuick 1.1
    
    Rectangle {
        width: 360
        height: 360
    
        Loader {
            id: loader1
            focus: true
            source: ""
        }
    
       Rectangle {
    
                id : uid
                width: 250
                height: 25
                anchors.horizontalCenter: parent.horizontalCenter
                y: 110
    
                Text {
                    id : pwd
                    text: "userId"
                    y: 5
                    font.pixelSize: 15
                }
    
                Rectangle {
    
                    id : pwdInput
                    width: 150
                    height: 25
                    border.color: "black"
                    anchors.right: parent.right
    
    
                    TextInput {
                        id : two
                        cursorVisible: true
                        anchors.fill: parent
                        KeyNavigation.tab: one
                        font.pointSize: 15
                        focus: true
    
                    }
                }
            }
    
            Rectangle {
                id : logIn
                height: 30
                width: 100
                anchors.horizontalCenter: parent.horizontalCenter
                y: 175
                color:  "#08407D"
    
                MouseArea{
                    anchors.fill: parent
                    onClicked: loader1.source="1.qml"
                }
    
                Text{
                    id: buttonLabel
                    anchors.centerIn: parent
                    text: "Log In"
                    color: "white"
                    KeyNavigation.tab: one
                }
            }
        }
    
    
    
    
    
    //// 1.qml
    
    
    import QtQuick 1.1
    
    Rectangle {
        id : root
        width: 400
        height: 400
        color: "steelblue"
    
        Item {
                id: item
                width: 200; height: 200
                Loader {
                    id:loader
                    source: ""
                    focus: true
                }
            }
    
            Rectangle {
                id : userName
                width: 250
                height: 25
                anchors.horizontalCenter: parent.horizontalCenter
                y: 75
    //            focus: true
    
                Text {
                    id : usrName
                    text: "Full Name"
                    y: 5
                    font.pixelSize: 15
                }
    
                Rectangle {
                    id : userNameInput
                    width: 150
                    height: 25
                    border.color: "black"
                    anchors.right: parent.right
    
                    TextInput {
                            id: one
                            focus: true
                            KeyNavigation.tab: two
                            font.pointSize: 15
                        }
                }
            }
    
            Rectangle {
            id : back
            height: 30
            width: 100
            anchors.horizontalCenter: parent.horizontalCenter
            y: 250
            color:  "#08407D"
    
            MouseArea{
                anchors.fill: parent
                onClicked: {loader.source="main.qml"}
            }
    
            Text{
                id: buttonLabel
                anchors.centerIn: parent
                text: "back"
                color: "white"
            }
        }
    }
    
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.