I've got an ApplicationWindow in my QML-Application. I'd like to execute a bit of Javascript-code right after loading it but don't find a handler (like onLoaded) to do so.
How can I accomplish this?
The handler you're looking for is Component.onCompleted. Here's a simple example:
import QtQuick 2.2
import QtQuick.Controls 1.1
ApplicationWindow {
visible: true
width: 500
height: 500
Rectangle {
id: rect
anchors.fill: parent
// First paint a red rectangle
color: "red"
}
Component.onCompleted: {
// Make it blue when we load
rect.color = "blue"
}
}