Unsolved Problem Updating display when Data has changed
-
I have a Qt GUI in a program that is asynchronously receiving data from an external source.
I need to persuade the GUI to update the display when the data that it is showing may have changed.
There are many screens to the GUI and some values are displayed on multiple screens, some of the objects being displayed are static but most are created dynamically, and there are often several instances of the same object that differ only in the data that they display.
What is the Qt Mechanism to force Qt to redraw the entire display ?
The code that displayed the screen in the first place properly retreives values from where they are stored, but it does not know that it needs to do so again.I expect this is a simple problem and my difficulty reflects a poor understanding of Qt. I am not primarily a GUI developer - this is an embedded laser controller project and my primary role is the code communicating with the laser.
Thank you
-
@dhlii said in Problem Updating display when Data has changed:
What is the Qt Mechanism to force Qt to redraw the entire display ?
There is no need to force redraw. Just change the content of affected widgets and they will redraw.
"The code that displayed the screen in the first place properly retreives values from where they are stored, but it does not know that it needs to do so again." - how do they retrieve the values? Usually, in Qt, you use signals and slots. The component responsible for data is emitting signals when new data arrives or existing data changes. And UI components connect their slots to that signals and update the UI as needed.
-
That data is not in the object, When the object is "repainted" it retreives the data.
Unless I misunderstand Signals and Slots are 1:1, to do something like Signals and Slots I need 1:many. There could be more than one object that "receives" the changed data.
I tried to use customEvents, but the "event" needs to hit every currently displayed object. If there is a way to do that - I have not figured it out.
I can not beleive this is difficult in Qt as the problem is fairly common, pretty much any real world device that receives and displays asynchronously sent data from some external device would have to do something similar.
-
@dhlii said in Problem Updating display when Data has changed:
Unless I misunderstand Signals and Slots are 1:1
You do. You can connect a signal to as many slots as you like.
"I can not beleive this is difficult in Qt" - I don't see what is difficult about it, in Qt it is done using signals/slots as I said...