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. QML set-up, parameters available onCompleted ?
Forum Updated to NodeBB v4.3 + New Features

QML set-up, parameters available onCompleted ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
1 Posts 1 Posters 197 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by SPlatten
    #1

    I have a QML file and I use a C++ class to provide additional functionality, is there any way to ensure the class is correctly set-up before use? I have several instances of the class where it is bound to properties in the QML, but I want to jump in and initialise the class before these are active ?

    Looking at https://doc.qt.io/qt-6/qml-qtqml-component.html, will try adding an onCompleted and see it that solves the problem.

    When a QML file is used multiple times in another QML file to represent different things, is it possible to specify when loading the QML what its purpose will be? In the same way parameters are passed to a constructor, is it possible to idenitfy what the QML is used for so when onCompleted is call the purpose can be known ?

    Actually it isn't to hard at all, can just reference the parent.

    [Edit] so I tried accessing parent.id, however this isn't defined, is there another option ?

    [Edit2] I was overthinking the problem, I already have properties in the QML which are set-up by each instance, all I needed to do was in the onCompleted access those properties.

    Kind Regards,
    Sy

    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