In my main window I've included an option to 'Check for updates' (available from a menu). Now, I'd prefer to start this updates check using a QTimer::singleShot(...) to prevent the menu from being "frozen" while the check for updates is ongoing and I've tried with the following:
void MainWindow::sendCheckForUpdates()
{
QTimer::singleShot(200,
this,
SLOT(checkForUpdates
()));
}
void MainWindow::sendCheckForUpdates()
{
QTimer::singleShot(200, this, SLOT(checkForUpdates()));
}
To copy to clipboard, switch view to plain text mode
So, triggering the 'Check for updates' QAction in the QMenu starts 'sendCheckForUpdates()', which I would hope would only create and start this QTimer::singleShot(...) and then immediately (after say 200 msec:s) return, which would "release"/"unfreeze" the menu.
However, for some reason this does not work for me. I can see that I enter sendCheckForUpdates(), pass the QTimer::singleShot(...) line with no errors and then exits sendCheckForUpdates(), but then nothing happens. I never enter checkForUpdates(). If I try to have only a direct call to checkForUpdates() from within sendCheckForUpdates(), then it works (but the menu is frozen until the task is finished).
Any ideas?
I'm using Qt 4.4.3.
Bookmarks