quimnuss
14th September 2015, 11:28
On a single-processor machine, I have a QSerial publishing data at 1Hz, whose signal is then processed and another signal is emitted to notify the GUI which updates the display.
On slow computers, the subsequent graphical display and computation might be sometimes slower than 1Hz, causing the signals to pile up and therefore the application display is dramatically delayed. I would like to skip "frames" when this happens, therefore ignoring the old signals and handling only the last one.
Right now I am trying to do a manual skip if I detect that fps is lower than 1Hz, but is there a way to discard/ignore the old signals when entering the slot?
The signal doesn't have any arguments, I just use it as signaling there's new input. So one might think that the data would always be the newest one anyway, even if unnecessarly displayed twice. But, the fact that the display displays old data is probably caused because the new signals from the QSerial aren't treated until the display slot is done, therefore the data is always the one the signal was sent for instead of the newest possible, because that serial data hasn't been processed by the middle-man processing object.
Is my reasonment correct?
I've found the function
QCoreApplication::removePostedEvents but what does
killing events may cause receiver to break one or more invariants. mean?
On slow computers, the subsequent graphical display and computation might be sometimes slower than 1Hz, causing the signals to pile up and therefore the application display is dramatically delayed. I would like to skip "frames" when this happens, therefore ignoring the old signals and handling only the last one.
Right now I am trying to do a manual skip if I detect that fps is lower than 1Hz, but is there a way to discard/ignore the old signals when entering the slot?
The signal doesn't have any arguments, I just use it as signaling there's new input. So one might think that the data would always be the newest one anyway, even if unnecessarly displayed twice. But, the fact that the display displays old data is probably caused because the new signals from the QSerial aren't treated until the display slot is done, therefore the data is always the one the signal was sent for instead of the newest possible, because that serial data hasn't been processed by the middle-man processing object.
Is my reasonment correct?
I've found the function
QCoreApplication::removePostedEvents but what does
killing events may cause receiver to break one or more invariants. mean?