Minimizing Application to Tray
Page |
2 |
If anyone still has this issue, the solution is to call qApp->processEvents() before calling hide(), ie.
- {
- {
- // make sure we only do this for minimize events
- {
- qApp->processEvents();
- hide();
- event->ignore();
- }
- }
- }
The test for the old state is probably unnecessary, but can’t hurt.
If this doesn’t help in your particular situation, try calling hide from a single-shot timer, so that the call is outside the minimize event handler:
- {
- {
- // make sure we only do this for minimize events
- {
- event->ignore();
- }
- }
- }
Hi Ryan,
take care if you call qApp->processEvents(), as you reopen the event queue and it might happen that an event, that should be worked on after you finished is processed now. I don’t say never do it, but do it with care and always remember, synchronous workflow is broken up here.
Even a deleteLater might be processed so an object can be deleted, where you expect it not to be deleted.
You must log in to post a reply. Not a member yet? Register here!




