1. Points to note when creating a thread using the QThread method Notes on inheriting QThread to create child threads: (1) You need to write a subclass that inherits QThread, and then you must rewrite the inherited run() function (rewrite the method to be executed in the thread (task function) in the run function) (2) […]
Tag: qthread
[Qt Threads] In-depth exploration of QThread thread priority: principles, applications and best practices
Directory title Detailed explanation of QThread thread priority Chapter 1: Basic concepts of QThread thread priority 1.1 What is QThread? 1.2 What is thread priority? 1.3 How to set QThread thread priority Table: QThread priority enumeration values Chapter 2: Internal mechanism and working principle of QThread thread priority 2.1 Internal mechanism: how to implement thread […]
QT multi-threading implementation: QThread run elegant creation and exit [QT multi-threading]
There are two ways to implement threads in Qt through inheritance. Inherit QThread, and then rewrite the run function to implement multi-threading Inherit QObject and use the moveToThread function to implement multi-threading This article introduces the creation, use and exit of the first type. 1. Introduction to running the QThread class 1. Use of QThread::run […]
QT multi-threaded collection of camera data processing and display (QVideoProbe+QCamera+QThread)
1. Introduction to the environment Operating system introduction: ubuntu 18.04, windows, Android QT version: 5.12.6 Camera: USB camera, virtual machine mounts the native camera 2. Function introduction Capture a frame of camera data through QVideoProbe in the sub-thread. After processing (adding time watermark), it is then sent to the main thread through the signal/slot mechanism […]
Use of QThreadPool and QRunnable for Qt multithreaded programming
When it comes to threads, you usually think of QThread, but in fact, there are many ways to create threads in Qt. Here we mainly introduce one of them, QRunnable. The usage of QRunnable and QThread is somewhat different, and the usage scenarios are also different. To introduce the usage, usage scenarios and precautions of […]
QThread of Qt multithreaded programming
Background introduction [GUI main thread + sub-thread] Much like C++11, Qt uses QThread to manage threads, and a QThread object manages a thread. There are many similarities in use to C++11, but more are unique to Qt. Content. In addition, the QThread object also has a message loop exec() function, that is, each thread has […]
Qt thread pool QThreadPool class, QRunnable class
QThreadPool class Used to manage QThreads. All functions in this class are thread-safe. Main attributes: 1. activeThreadCount: This attribute indicates the number of active threads in the thread pool, which is called by activeThreadCount(). 2. expiryTimeout: The time the thread is alive. Threads with no expiryTimeout milliseconds set will automatically exit, and such threads will […]
QT’s Qthread mechanism
Directory Some mechanisms and usages of QT’s Qthread Finally, a brief summary of the purpose of QThread! Some mechanisms and usages of QT’s Qthread QT provides QThread class for multitasking. Like multitasking, the threads provided by Qt can do things that a single thread cannot. For example, in a web application, threads can be used […]
The moveToThread method of Qt QThread uses
Introduction to Qt threads Since the Qt4.4 version, because the implementation of QThread’s run method to create a new thread is inconsistent with the concept of Qt design, Qt mainly promotes the use of the moveToThread method to create a new thread. QThread should be thought of as an interface or control point to operating […]
Qt multi-threaded programming knocks on the door of the QThread class
Overview Before reading this article, you need to know about processes and threads. For details, refer to “Multithreading Technology in Qt”. In many articles, people tend to regard QThread as the entity of a thread, and creating a QThread class object is considered to be a new thread. Of course, this kind of cute view […]