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. Events disabled during moving or resizing

Events disabled during moving or resizing

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 2.1k 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.
  • _ Offline
    _ Offline
    _Mark_
    wrote on last edited by
    #1

    Hi,
    while you're moving or resizing a QMainWindow it seems all the events are disabled. This is an odd behavior for some application, say when you're plotting "real-time" data on a graph.

    What is the recommended way to allow the events handling also while moving/resizing?
    I'm using Qt 5.3 under Windows 7.
    Thanks

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi,

      which events seem to be disabled?
      How do you send events? via postEvent with custom events?

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • _ Offline
        _ Offline
        _Mark_
        wrote on last edited by
        #3

        I'm talking about signals and slots, I'm sorry if I used the word "events" improperly.

        For example I have the readyRead() slot from a QSerialPort which is not called when I'm moving the QMainWindow.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          Ok, now wer are getting it. In which thread is the QSerialPort done?
          Signals/Slots across threads are in fact event messages. These are serialized via the message queue. Maybe, moving the windows does not return to the message queue untill the window is in its final position, which means, no event processing in between. This implies no cross thread signals/slot to the main thread.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • _ Offline
            _ Offline
            _Mark_
            wrote on last edited by
            #5

            Well, it's in the same thread of the QMainWindow.
            If I understand correctly even if I move the QSerialPort in another thread I still can't process the incoming messages in the QMainWindow. This is odd, because I must update the graph con this form and I cannot do this in a separate thread, can I?

            Is there any workaround?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #6

              No, all UI activities must be done in the main thread. And if the user drags the window which might block the main thread, you can't do UI updates in between. You will also not get any QSerialPort stuff done in that time, unless it is done in a separate thread.

              You could check the Qt code what happens in moving a window, whether it is done by Qt itself or by the OS code.

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              1 Reply Last reply
              0
              • _ Offline
                _ Offline
                _Mark_
                wrote on last edited by
                #7

                That's odd!

                Anyway, the signals emitted and not received are lost or just queued?
                I'm going to move the QSerialPort in another thread and, from there, emit signals to update the UI.

                When the user stops moving the window, will I receive the signals emitted in the meanwhile? so I can update the plot without loss of data.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on last edited by
                  #8

                  depends on the hardware, right? Events are typically queued in the message queue. But I am sure, QSerialPort will fetch the serial data froim the hardware, once it gets called from the main thread.

                  If you move the serial port to a worker thread, the signals will be kept and executed later.

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  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