Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTimer events not executed when holding minimize/maximize/close button.
Qt 6.11 is out! See what's new in the release blog

QTimer events not executed when holding minimize/maximize/close button.

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jeroen3
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jeroen3
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          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).aspx

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

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jeroen3
            wrote on last edited by
            #5

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

            Creating thread makes the overall software design too complicated.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved