ProgressBar doesn't redraw until function returns control
-
Greetings!
I'm redesigning an application which handles telemetry data and performs visualization to use QML for it's GUI.
Data processing takes noticeable amount of time on large input files, so I've decided adding a progress bar for indication.
Processing method emits a signal when called, a signal per each fifth iteration and a signal before return, but the GUI never redraws before the method return control.
Is there a viable solution to force redraw from QML signal handler?
@import QtQuick 1.1
import com.hertz 1.0
import "ProgressBar" // from QtExamplesItem {
width: 300; height: 250Opener {
id: opener
onStart: { console.log('Started'); pb.value = 0 }
onProcess: { pb.value = val; Qt.processEvents() }
onEnd: console.log('Finished')
}ProgressBar {
id: pb
width: 300
}MouseArea {
anchors.fill: parent
onClicked: opener.open()
}
}
}@
P.S. I cannot alter Opener class (the only allowed modification is addition of three signals and their emission during data processing. Since there is no such standard component as ProgressBar, I see a solution in implementing ProgressBar in C++ and then exporting it to QML, but I hope there is a more elegant solution.