Hi,

On 06/08/2021 13:43, Vinoth Rajendran wrote:
I have seen in qt documentation that a single thread(GUI thread) is created by a program at start-up. But I could see a bunch of threads in the main() function. Can someone help me understand it ?

Please find the screenshots for reference,

threads.png <https://ddgobkiprc33d.cloudfront.net/48ec7519-dd52-4d06-b63e-b70b0d576ffc.png>

Here i could see around 8 threads created

Qt may spawn additional threads internally. ~100% of the time, they're invisible to the developer, and used just by Qt for its own purposes. In other words, the code you're going to write will run in the main thread and you'll never know about the other threads. Just ignore their existence.

QtQuick has one special thread of you should aware of, which is its rendering thread. If you plan to do custom drawing, in C++, using QtQuick APIs, then the docs will tell you about this rendering thread and how to avoid shooting yourself in the foot. But if you just use QtQuick from QML, or use C++ drawing bits that aren't related to QtQuick (like QImage, then again everything will be ran in the main/GUI thread.

Hope this helps,

--
Giuseppe D'Angelo | [email protected] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to