Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to open dozens of threads at the same time in QT multithreaded class array?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "QT multithreaded class array at the same time open dozens of threads how to achieve", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "QT multithreaded class array open dozens of threads at the same time how to achieve" it!

Let's first define a thread class: textTread

Texttread.h

View source#define TEXTTREAD_H

04.#include

05.

06.class textTread: public QThread

07. {

08.Q_OBJECT

09.public:

10.textTread ()

11.void run ()

12.signals:

13.void sendGUIThreadData (QString str); / / signal to communicate to the main thread

14.public slots:

15.void GetGUIThreadID (int mThreadID); / / the slot that receives data from the main thread

16.private:

17.int ThreadID

18.}

19.

20.#endif / / TEXTTREAD_H

Let's take a look at texttread.cpp.

View sourceprint?

01.#include "texttread.h"

02.#include

03.textTread::textTread ()

04. {

05.}

06.void textTread::run ()

07. {

08.qDebug ()

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report