Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript QML和QThread多线程_Javascript_Multithreading_Qml_Qthread - Fatal编程技术网

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
}