【发布时间】:2016-11-08 10:01:40
【问题描述】:
我在加载 qml 文件 (http://doc.qt.io/qt-5/qml-qtquick-loader.html) 时尝试运行 BusyIndicator (http://doc.qt.io/qt-5/qml-qtquick-controls-busyindicator.html),但 BusyIndicator 没有出现。
我想做的是: 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;
}
}
}
【问题讨论】:
标签: qt qml loader busyindicator