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. Is it possible to determine caller of event Component.onCompleted without "id" ?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to determine caller of event Component.onCompleted without "id" ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 218 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
    r3d9u11
    wrote on last edited by r3d9u11
    #1

    Hi. Is it possible to determine component who called event Component.onCompleted but without "id" property ?

    Simple example:

    ListModel {
       Component.onCompleted: {
          for (var i = 0; i < 50; ++i) 
             append({ "modelData": i }); // how to call it for ListModel but without definition of "id" property directly?
       }
    }
    

    For example, C# usually have argument "object sender" in event arguments, which contains reference to object-caller.

    Thanks!

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      You just did. Your code works as posted.

      What's inside Component.onCompleted has the same scope than ListModel.

      R 1 Reply Last reply
      3
      • GrecKoG GrecKo

        You just did. Your code works as posted.

        What's inside Component.onCompleted has the same scope than ListModel.

        R Offline
        R Offline
        r3d9u11
        wrote on last edited by
        #3

        @GrecKo Well, it's so funny, You are right:-D
        I've got error, but seems like in other place. Now it works

        My mistake

        Thanks!

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved