QTimer events not executed when holding minimize/maximize/close button.
-
I noticed that events are not being executed when I hold down the minimize, maximize or close key in Windows 7.
Is there some way to work around this without creating threads?
-
A C++ builder program does the same thing so its a windows thing/normal.
You could try to override event and see if any event is sent when "holding".
I assume the button get all events and hence no WM_TIMER is sent to the main window.bool MyMainWindow::event(QEvent * e)
{
switch(e->type())
{
} ;
return QMainWindow::event(e) ;
} -
Wel, I did create the event override.
bool MainWindow::event(QEvent * e){ qDebug() debugprefix << e->type(); return QMainWindow::event(e) ; }
And when holding any of the 3 controls, all events stop.
-
So a thread it is. :)
If you really, really dont want a thread,
you could look into using a timer callback instead of events.
This is windows only. / not portable.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644901(v=vs.85).aspxReading the documentation, it seems Qt demands a message loop for Qt-timers.
-
Or I just disable/hide the misbehaving keys.
setWindowFlags( Qt::WindowCloseButtonHint );
orsetWindowFlags( Qt::WindowTitleHint );
Creating thread makes the overall software design too complicated.