How to get a property of one QML file to other QML file if their are not in same folder



  • Hi,

    I have a problem in getting a property from one QML file to other QML file whre I need to assign it to keyNavigation . Over here, I am explaining it

    @Title.qml
    FocusScope{
    id: title

    property Item titleID: title
    
    anchors.fill parent
    

    }

    @MenuScreen.qml

    FocusScope{

    id: menuScreen

    property Item cursorToItem

    anchors.fill: parent

           //Here currentIndex is value of Items in the screen
                     KeyNavigation.up: cursorToTitle
            KeyNavigation.priority: {
                switch(currentIndex) {
                case 0:
                case 2:
                case 4:
                case 6:
                case 8:
                case 10:
                case 12:
                case 14:
                case 16:
                case 18:
                    KeyNavigation.BeforeItem;
                    break;
                default:
                    KeyNavigation.AfterItem;
                    break;
                }
            }
    

    }

    Now I want assign titleID to cursorToTitle property of menuScreen.qml where I can get Title.qml ID

    How can we do it, can any one help me on this part.

    Thanks



  • To access a qml file in a parent folder you add a import like this

    import "../"
    

    to access a qml file in a children folder you add a import like this:

    import "childrenfolder"
    

Log in to reply
 

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