Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Any way to get a callback when Qml item is created but before properties are accessed?

    QML and Qt Quick
    2
    2
    222
    Loading More Posts
    • 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
      patrickkidd last edited by patrickkidd

      I have a C++ QObject type that can be created in Qml, and I want to be able to initialize the object after it is created by before properties start getting set on it. Is this possible?

      This is because I have an initialize() method that the superclass requires to be called after the subclass constructor is called, and there may be multiple levels of subclasses.

      A QObject::Created event or created() would work if they occurred immediately following the new MyType() call and before the object was used.

      Thanks!

      https://vedanamedia.com/

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @patrickkidd last edited by

        @patrickkidd
        implement the QQmlParserStatus::componentComplete() interface

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 0
        • First post
          Last post