我一直試圖運行BusyIndicator(http://doc.qt.io/qt-5/qml-qtquick-controls-busyindicator.html),而我加載一個qml文件(http://doc.qt.io/qt-5/qml-qtquick-loader.html),但BusyIndicator沒有出現。QML BusyIndicator,同時加載一個沉重的qml文件
我想要做的是: 1-用戶發出一個「handlerLoader(name)」,其中「name」是下一個qml頁面的url。 2-在「onHandlerLoader」中,我運行busyIndicator。 3,然後,我更改加載程序源。
問題是,無論我在第2步和第3步之間花費多少時間,BusyIndicator都沒有出現。
此外,當我註釋步驟3時,busyIndicator顯示正確。
我做錯了什麼?
謝謝!
這是代碼:
Rectangle {
visible: true
width: 800
height: 480
signal handlerLoader (string name)
Loader {
id: pageLoader;
source: "init.qml";
}
BusyIndicator {
id: busyIndicator_inicio
width: 100
height: 100
anchors.centerIn: parent
running: false
}
Connections {
target: pageLoader.item
onHandlerLoader: {
busyIndicator_inicio.running = true
pageLoader.source = name;
}
}
}