0

I use a class

class DesktopFileScanner : public QThread 
{ 
void scan() { start(QThread::HighPriority)); }
void run() { /* the scanning instructions here*/}
/**/ 
};

to perform time consuming (~2 sec) operations. I'd like to show a busy indicator while the scanner is doing this. The busy indicator is called

ind

The qml Sheet has this property:

Component.onCompleted:
{
    scanner.scan() // scanner is an instance of DesktopFileScanner
    ind.visible = false
}

This way the indicator becomes invisible before scanner finishes scanning. How can I fix it so that

ind.visible = false 

will be called after scanner thread is finished (scanner finishes scanning)

thanks in advance

marmistrz
  • 5,974
  • 10
  • 42
  • 94

1 Answers1

1

Connections item in QML can be used

Component.onCompleted:
{
    scanner.scan()
}

Connections
{
    target: scanner
    onFinished: ind.visible = false
}
marmistrz
  • 5,974
  • 10
  • 42
  • 94