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?

  • Qt Champions 2017

    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)
    } ;
    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.

  • Qt Champions 2017

    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.

    Reading the documentation, it seems Qt demands a message loop for Qt-timers.

  • Or I just disable/hide the misbehaving keys.
    setWindowFlags( Qt::WindowCloseButtonHint ); or setWindowFlags( Qt::WindowTitleHint );

    Creating thread makes the overall software design too complicated.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.