Events not called unless mouse is moving
I have a problem where it appears that events generated by QTimer and QExtSerialPort don't get called unless the mouse moves. It is as though the event loop isn't running unless being fed with mouse move events.
The application structure is as follows. There is a main application derived from QApplication and a main window derived from QMainWindow all in the usual way. There are also widgets e.g. graphWidget which show data graphically which are derived from a fooWidget class which itself is derived from QWidget. In, for example, graphWidget I have a QTimer which updates the graph at a regular interval. The problem is the graph doesn't get updated unless I keep moving the mouse. I.e. the event slot that the QTimer is connected to, isn't executed unless the mouse is moving.
The same is true for the communications class gathering data from the serial port using QExtSerialPort. There is a barWidget class derived from QWidget and a serialComms class derived from barWidget, in the serialComms class there is QExtSerialPort getting data from the serial port but its events slot which is connected to the ReadyRead() signal is also not called unless the mouse is moving.
All the above classes are constructed using 'this' from the mainWindow class. To get the events to be called, the mouse needs to be moving above the Qt application, if the mouse is moving anywhere else on the desktop the events don't get called.
Has anyone seen this before? Can you shed any light on it please?
Welcome to the forum.
It is a little difficult to picture what you have coded. It seems already quite complex. Can you post a small compilable example showing your problem?
It's a bit difficult to since the application is a reasonable size running at about 50,000 lines of code at the moment and I'm probably only half way there.
I did write a quick application based on QDialog to test the QExtSerialPort class with just a QLineEdit for the bytes to transmit, a QPushButton to send the bytes and a QTextBrowser to display the bytes received. It all worked perfectly, so I can't generate the problem outside of the main application.
Events not being handled properly sounds like an event-loop-reentry problem. Do you call exec() on dialogs or QApplication::processEvents() somewhere?
If you can anything that displays this issue, please submit it. It is very hard for us to help you without any code we can read or (even better) try.