Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to get a property of one QML file to other QML file if their are not in same folder
Qt 6.12 LTS is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 891 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.
  • R Offline
    R Offline
    RG90
    wrote on last edited by RG90
    #1

    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

    1 Reply Last reply
    0
    • johngodJ Offline
      johngodJ Offline
      johngod
      wrote on last edited by
      #2

      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"
      
      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
      • Unsolved