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. Connections to attached signal
Qt 6.11 is out! See what's new in the release blog

Connections to attached signal

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

    I have some object:
    @MyWindow {
    id: mainwindow
    }@

    and want to catch it's Component.onCompleted in some other place. I do it like this:

    @Connections {
    target: mainwindow
    Component.onCompleted: console.log("got it");
    }@

    However, instead of catching onCompleted of my target object, I get onCompleted of Connections object itself.

    Please help me to understand, how can I achieve my goal to get onCompleted signal of target object?

    Thanks a lot!

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi, and welcome to the Qt Dev Net!

      I don't know how to connect to an attached signal externally, but you could implement a custom signal in mainWindow and emit that when the window is completed.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pavelvasev
        wrote on last edited by
        #3

        Dear JKSH!

        Thanks for your advice! I did the same for now and it works.

        I develop some application framework, and it is good for me to catch this signal directly, because in other way I have to ask users to implement that custom signal.

        In my situation, we control the base object, "MyWindow". So I put that custom signal there. It looks almost same as onCompleted in MyWindow user's descendant.

        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