recently I'm working on Point cloud Library project with QT. I'd like to know if I can know the current progress when I use a function.
For example, I create a class name system with a public function named estimate_normal. Inside this estimate_normal, I call some functions from the PCL library, and in MainWindow.cpp I call
system a;
a.estimate_normal();
Can I know the progress by using QT Progress bar to see this estimate_normal status?
Thanks
解决方案
You should create your object of the class "system" on the heap and move it to a new thread in order to prevent estimate_normal() from blocking main thread and the UI. This can be done like:
a = new system();
QThread * th = new QThread();
a->moveToThread(th);
QObject::connect(th,SIGNAL(started()),a,SLOT(OnStarted()));
QObject::c