thread in subwindow
-
I have never used thread being a beginner.
I receive and send information by CAN from an external device.
the information are many (more than 50) and create a single window with 50 texts boxes is too confusing for the user.
The idea is to insert few button in the Mainwindow and each of them, can call a sub-window. To be more clear in my explanation: let say that the CAN get the information of the market articles. it will be the button "fruits" and the button "bread". the button will open a sub-window to show the info of its article.So IN the maiin class "Mainwindow" will be the buttons to instantiate and show the classes of the sub-windows.
An external thread will handle the CAN communication.Now finally my question: how can I "transport" the information from the thread of the CAN to the sub-class loop? Global variable ?
Thanks in advance
-
@JonB Thanks for your reply.
I wrote and play with signal and slots in the .ui file of the project. For example a Dial that updates a progress bar. In this example a widget is connected with another widget. My issue is a connection from a GUI 1 (MainWindow) to another gui, that is called in the GUI1. How can the guis comunicate each others ? -
@FaTr
In a word, forget using the Designer facility for connecting signals to slots within the class. It's very limited, doesn't do anything you can't do easily yourself and (as you say) does not show you how to do your own connects across classes.The syntax of
connect()
is:connect(signallingObject, &SignallingClass:signalMethod, slotObject, &SlotClass::slotMethod);
So you need an instance of the class which emits the signal and an instance of the class which receives the signal. These can be different classes, as in your desired case. The usual place to put the
connect()
is either in the slot class or in a class which knows about both the signal and slot classes. Do not put it in the signalling class --- slots know about signals, but signals should not know about slots.