Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML Component event order
Qt 6.11 is out! See what's new in the release blog

QML Component event order

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 511 Views 2 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'm reasonably new to QML and always learning, I have inherited a large project with a lot of badly written QML with a lot of JavaScript and calls to routines in the C++ application.

    Much of this hasn't been written using any sensible software development guide lines and there are multiple ways of achieving the same thing which isn't good.

    I would like to explore if I can improve this and make it more deterministic. I have read and can see that some of the QML uses Component.onCompleted, not in many cases.

    I could like to see if I can use these when a page is loaded to set-up the QML using the C++ calls that I have available. Also is the onDestruction event called when the QML is changed to another?

    I've been experimenting with Component, I added this to one of the pages:

        Component.onCompleted: {
            console.log("******** HACK my.qml onCompleted L###");
        }
        Component.onDestroyed: {
            console.log("******** HACK my.qml onDestroyed L###");
        }
    

    I can see that when the page is loaded I get the onCompleted message in the Application Output, but I don't see the onDestroyed if I change the page, only when the application is terminated. Is there any way to pick up when the page changes?

    I tried adding:

        Component.onStatusChanged: {
            console.log("******** HACK my.qml onStatusChanged L###: " + status);
        }
    

    But this resulted in the application crashing with a critical error handler on launch, removing it solved the problem.

    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