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. How to access the property from one qml file in another.

How to access the property from one qml file in another.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 643 Views 2 Watching
  • 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.
  • J Offline
    J Offline
    JennyAug13
    wrote on last edited by JennyAug13
    #1

    I have my settingsDialog.qml file and player.qml file. I have an instance with an id settingsSwitch inside my settingsDialog and i want to access the user defined property called secondSettingSet inside my player.qml file.

    Here is the code:

    settingsDialog.qml file
    psdDialog
    {
        id: psd
        property bool secondContractionSet: false
        ....
        ....
        ....
      settingsSwitch 
    {
        if(program.model)
        {
            secondSettingSet = true;
        }
      } 
    }
    

    I have my player.qml file and inside that, i want to access the property secondSettingSet . How can i do that. And using alias to the id and different ways when i tried I am unable to access the property in my player.qml file. And they have no common parents or children except the main.qml fíle. Can't i directly access the property without touching my main.qml file?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Padlock
      wrote on last edited by
      #2

      You could make it a C++ property. This gives you the same functionality without placing it in the main.qml file.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sharath
        wrote on last edited by sharath
        #3

        You can achieve it by making one Qml file as singleton and declare the properties you want to access it throughout the project.

        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