Batch image process freezes the GUI
Hi!
I have an application that aims to resize some pictures, listed in a QTreeWidget.
If I try to do it with a loop in the MainWindow (with a large number of pictures) it causes the GUI to freeze:
Code:
for (int i = 0; i < ui->listTreeWidget->selectedItems().count(); i++)
{
QImage image
(ui
->listTreeWidget
->selectedItems
().
at(i
)->text
(5));
image.
save("test" + QString::number(i
), ui
->formatComboBox
->currentText
().
toLower().
toAscii(),
100);
}
I know that a solution is to use a separate thread, so the GUI won't freeze anymore. I know how to do this, but I can't access the QTreeWidget properties from the QThread, and so I can't load the QImage.
Is there a way to do this? Maybe pass some argument to the QThread from the MainWindow?
Or is there any other solution except using a separate thread?
Thanks for help :)
Re: Batch image process freezes the GUI
Have you read this?
[wiki]Keeping the GUI Responsive[/wiki]
Re: Batch image process freezes the GUI
No, I didn't read that article :)
Thank you very much!