QThread with a GUI
Unsolved
General and Desktop
-
Good morning, everyone,
still in my learning with QThread, I have a problem, like how to adapt a QThread with a graphical interface;
here is my problem: I have a server and I want to use the thread in my server class, knowing that it has several functions in its breast, example of the code:class server { public: serveur(QObject *parent); void function1(); void function2(); void function3(); void function4(); signals: // public slot: // private: int number QString string; }
now I'm asking myself a question, do I have to make the Server class inherit QThread to execute several functions simultaneously?
and if so, how to execute function1(), function2() and function5() at the same time?Thank you in advance for your help
-
Hi,
Before starting to play with threads, take a look at the QtConcurrent module. It might do what you need without having to dive into the subtleties of threading.
-
One option as suggested by @SGaist
- QtConcurrent module. Still if you want to
- Inherit your object from QObject. Create thread object, Move your object to QThread.
- Last option is you have inherit from QThread and implement run method.
If you want to run all the three methods at same time, multiple thread objects are required.