Qt project stops working when changing location mainwindow
I am working on a project which is collecting much data continuously from BUS. Im able to build and run without any problem. Everything is perfect ultil i try to relocate my projects mainwindow on running project(meanwhile data is still incoming). My data flow is stopping when i click projects window to relocate it. And it continues from where it paused when i release my left click on window. What am i missing? Thanks in advance.
Re: Qt project stops working when changing location mainwindow
Quote:
What am i missing? Thanks in advance.
Moving (and probably resizing, too) the main window is a blocking operation. The Qt event loop is handling both UI interactions and the data coming from your bus, so when a blocking operation occurs, the data stops. The same thing would happen if you opened a modal QDialog - the dialog has its own event loop, and the main event loop will be suspended while the dialog is open. As you observe, no events are lost, they just accumulate until the main event loop gets to run again.
The solution is to move your data collection to a separate thread, independent of the GUI thread. Each Qt thread has its own independent event loop, so data collection can continue no matter what the main GUI thread is doing.