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. Passing signal from C++ to object in loader
Forum Updated to NodeBB v4.3 + New Features

Passing signal from C++ to object in loader

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.5k Views 1 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.
  • B Offline
    B Offline
    bricke
    wrote on last edited by
    #1

    Hi everyone, I'm having some issues on passing a signal from C++ to a loader that handles the object I need to receive the signal.

    The struct is:

    -C++ Layer (emits the signal, object correctly connected to main.qml file)
    -Main.qml (main with many object and a loader)
    -Loader Obj
    -Item loaded (I need the signal to arrive here)

    I've several files that my loader will load and every file handles that signal, so I need to find a solution that could work even if I change the loaded file.

    Any suggestions?

    Thank you.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      melghawi
      wrote on last edited by
      #2

      If I understood you correctly, you would like to dynamically load a file using the Loader component and then connect the loaded object to a signal that is emitted from the C++ layer.

      Why don't you try something like this:

      @
      Loader {
      id: loader
      onLoaded: CPPLayer.signal.connect(loader.item.slot);
      }
      @

      I have not tested this as I am unsure how your C++ layer connects to QML but hopefully this will give you some ideas.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bricke
        wrote on last edited by
        #3

        Thank you.
        By now I've solved my problem adding a Connection element on the loaded component, on every sub-component of the loaded item!

        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