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. Composing QML objects from different files: Accessing functions in parent

Composing QML objects from different files: Accessing functions in parent

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 234 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.
  • M Offline
    M Offline
    maxwell31
    wrote on last edited by
    #1

    Hi,

    Lets assume I have a file Plot.qml and files PlotOverlayA.qml and PlotOverlayB.qml. I don't want to move PlotOverlayA into Plot.qml as it is only needed in some circumstances and my Plot.qml file would get quite bloated if I moved every component there.

    If I use my plot component, I would like to do something like

    Plot {
    
        PlotOverlayA {
    
        }
    
    }
    

    Plot.qml has a signal update and I would like to connect to this signal in PlotOverlayA.qml. If I receive this signal in PlotOverlayA, it should bexecute a function defined in Plot.qml (like getXCoordinates). However, I don't know how I can access the functions of Plot.qml.

    1 Reply Last reply
    -1
    • guerinoniG Offline
      guerinoniG Offline
      guerinoni
      wrote on last edited by
      #2

      Maybe I don't understand, if you connect signal update in Plot with function in in the same file it doesn't enough? You can also connect signal from Plot with something in PlotOverlayA using id property

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maxwell31
        wrote on last edited by
        #3

        What I am trying to do is to create a flexible and reusable plot component. I would like to keep the interface (the properties of Plot.qml) small, and hope that this is achievable via "extending" the Plot component e.g. with a PlotOverlay as shown above. So PlotOverlay should be seen as tightliy coupled to plot. I will try with the id

        1 Reply Last reply
        0
        • A Offline
          A Offline
          arkceajin
          wrote on last edited by
          #4

          If I receive this signal in PlotOverlayA, it should bexecute a function defined in Plot.qml

          Do you mean "emit the signal" in here?

          are the PlotOverlayA only children item of Plot?

          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