The shortest possible way to solve the problem is to add a call to QCoreApplication::processEvents().
void RoboSearch::listFiles()
{
searchButton->setEnabled(false);
// let the application process its events
//code is searching through files, so it takes ~5s
searchButton->setEnabled(true);
}
void RoboSearch::listFiles()
{
searchButton->setEnabled(false);
// let the application process its events
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
//code is searching through files, so it takes ~5s
searchButton->setEnabled(true);
}
To copy to clipboard, switch view to plain text mode
5s is a long time for a GUI application to be frozen so you might want to call the same method every now and then during the search.
Bookmarks