0
votes

I'm trying to debug my QML application which is experiencing freezes at load. I'm not getting Component.onCompleted signals from any of my components, so I'm trying to check the Component.status changes, however QML is throwing a Cannot assign to non-existent property "onStatusChanged" warning when I try with the following example. How can I get notified of status or progress changes on components?

import QtQuick 2.14
import QtQuick.Window 2.14
import QtQuick.Controls 2.14
import QtWebEngine 1.10
import QtWebChannel 1.0


ApplicationWindow {
    width: 600
    height: 480
    visible: true

        WebEngineView {
            anchors.fill: parent
            url: "https://www.xkcd.com"
        }

    Component.onCompleted: print("Completed")
    Component.onStatusChanged: print("Status changed: ", status)
    Component.onProgressChanged: print("Progress changed: ", progress)
}
1

1 Answers

1
votes

You can't access Component properties, like status from there. You can only access the onCompleted signal because it's an "attached signal". I would use a Loader to track progress. Try it like this:

Loader {
    asynchronous: true

    sourceComponent: WebEngineView {
        anchors.fill: parent
        url: "https://www.xkcd.com"
    }

    onProgressChanged: {
        console.log("progress: " + progress)
    }
}