Javascript QML和QThread多线程
我使用一个类Javascript QML和QThread多线程,javascript,multithreading,qml,qthread,Javascript,Multithreading,Qml,Qthread,我使用一个类 class DesktopFileScanner : public QThread { void scan() { start(QThread::HighPriority)); } void run() { /* the scanning instructions here*/} /**/ }; 执行耗时(~2秒)的操作。我想在扫描仪执行此操作时显示忙指示灯。繁忙指示器被称为 ind qml工作表具有以下属性: Component.onCompleted: { s
class DesktopFileScanner : public QThread
{
void scan() { start(QThread::HighPriority)); }
void run() { /* the scanning instructions here*/}
/**/
};
执行耗时(~2秒)的操作。我想在扫描仪执行此操作时显示忙指示灯。繁忙指示器被称为
ind
qml工作表具有以下属性:
Component.onCompleted:
{
scanner.scan() // scanner is an instance of DesktopFileScanner
ind.visible = false
}
这样,在扫描仪完成扫描之前,指示器就不可见了。
我怎样才能把它修好
ind.visible = false
将在扫描仪线程完成后调用(扫描仪完成扫描)
提前感谢可以使用QML中的连接项
Component.onCompleted:
{
scanner.scan()
}
Connections
{
target: scanner
onFinished: ind.visible = false
}