QProgreesDialog updating from within threadable function
Hi there. I have got a question for you, guys, which I really would like you to help me with.
I have got a function with QString parameter and within the function long-time procedures take place. I execute this function with QFuture but I would like for the progress of operation to be indicated. For example I can declare the variable inside the function and which varies between 0 and 100. How can I arrange it and bind to QProgressDialog? Here goes the snippet:
Code:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(this->ui->test_button, SIGNAL(clicked()), SLOT(call_algorithm()));
}
void MainWindow::call_algorithm()
{
QFuture<void> future = QtConcurrent::run(algorithm, this->ui->jpg_name_edit->text());
}
{
//some code here =)
}
Re: QProgreesDialog updating from within threadable function
In QtConcurent functions you can use either static functions ( like your algorythm ) or your class's member function, where you can emit a signal to show the progress of computations. See binding section in QtConcurent docs
Re: QProgreesDialog updating from within threadable function
I have solved that. Thanks anyway.
Re: QProgreesDialog updating from within threadable function
Hi Astrologer,
Could you post an example with the solution you found and adopted?
Thanks,
Wladek