S
S
Sazoks2020-08-28 19:42:45
Qt
Sazoks, 2020-08-28 19:42:45

Is it true that slots in Qt are executed on their own thread?

Recently I saw such a statement that each slot in Qt is executed in its own, new, thread.
Example:

TypeClass obj1;
connect(&obj1, &TypeClass::Signal1, this, &MainClass::SomeFun1);
connect(&obj1, &TypeClass::Signal2, this, &MainClass::SomeFun2);

Those. if 2 events (signal1 and signal2) happen at the same time, will the slots I need be executed simultaneously?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ighor July, 2020-08-28
@Sazoks

The slot runs on the thread in which the slot's QObject is created or moved to (if connected as a Qt::QueuedConnection).
In your case, all slots will be executed in this->thread();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question