Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Threads and GUI

$
0
0
Hi, I am relatively new to Qt, so excuse my ignorance. I have a Qt application with a main window and a TCPServer. The TCPServer is forking, in the sense that it creates QThreads and pushes worker QObjects into them. Now the QObjects which are created by the TCPServer contain a lot of data which they display on their own GUI. I had initially created a ui xml with the QObject which was to display all this data (taken from the local variables of the QObject). But I understand now that the GUI needs to be run in the main thread. Although I know that signal-slot would be the best way to send the QObject data to the main thread and launch the ui from there, I am not sure how to encapsulate the following before pushing it via a slot: 15 Nos. of bool (checkboxes) 15 Nos. of quint8 (comboboxes) 10 Nos. of QStrings (lineEdit) Should I create a structure to hold this and push that via a signal (any Qt specific best practice to use structures)? Or should I declare all this data public in the QObject and access if from the main thread (bad OOPS programming I guess) ? Any other correct and efficient way? Also am I right in understanding that signals-slots mechanism does not actually copy data, so the overhead to “send” this data is minimum? I would like to also say in my first post that I am enjoying my Qt experience. It is a wonderful tool which I met 2 months ago, being a hardware designer essentially. Thanks newspaper

Viewing all articles
Browse latest Browse all 13965

Trending Articles