Questions tagged [queued-connection]

Qt::QueuedConnection is a connection type between a signal and a slot.

A signal and a slot can be connected in several ways, one of which is Qt::QueuedConnection. When this connection type is used the slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread. Learn more about it here and here.

12 questions
8
votes
2 answers

QObject::connect: Cannot queue arguments of type MyClass*const

I have such class: #include namespace taservices { class ProcessHandle : public QObject { Q_OBJECT public: ProcessHandle(const void* const processContextPointer, const QString& process_id = "", QObject *parent =…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
2
votes
1 answer

Invoke slot asynchronously without connecting to it using clear line of code

I have encountered quite freaky bug - QAction::trigger caused blocking dialog to appear, which caused my server which called trigger to go stuck (eg. not able to process socket signals until dialog was closed). I figured out a workaround. I connect…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
1
vote
2 answers

Is Qt's event loop thread safe or atomic? How is it synchronised when dealing with `QueuedConnection`?

Suppose 2 QThreads are running with following relation: connect(&Object1OfThread1, &Object1::Signal, &Object2OfThread2, &Object2::Slot, Qt::QueuedConnection); So when an object from one thread raises a signal, the other thread's slot is…
iammilind
  • 68,093
  • 33
  • 169
  • 336
1
vote
1 answer

Qt::QueuedConnection not working with some object

In my application, we have a simple connection between signal slot. connect(&A, SIGNAL(signal(myObject)), &B, SLOT(slot(myObject)); This connection, unfortunately, will lead to a recursion. Then we changed it into connect(&A,…
n3mo
  • 663
  • 8
  • 23
1
vote
0 answers

QT5 Cross-thread communication, slot not called in "this" context

I have an object MainWorker ran as a separate thread thanks to moveToThread method. MainWorker has a member SubWorker which is also ran as a separate thread. Both threads are working in infinite loops. The idea is, MainWorker and SubWorker both…
styku
  • 146
  • 6
1
vote
2 answers

Logging queued connections

I am using a complex state engine system build with Qt 5.4 (using custom state engine classes). Part of that code is logging of events, transitions, etc. It is very important for me to log all events the engine/state objects are receiving so I can…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
0
votes
0 answers

Queries are getting queued when multiple user trying to access Database(Same table) db2 warehouse on cloud

Queries are getting queued when multiple user trying to access Database(Same table) db2 warehouse on cloud. We are using DB2 Warehouse on cloud and our Analytical report tool is Dundas and Cognos. When multiple user using same Dashboard/report that…
0
votes
1 answer

Qt Multi-Thread Queued Connection Signal / Slot Issue (SLOT does not trigger)

Struggling emitting a signal from main/QML thread to another thread with a QList< QStringList > parameter. Variations I'v tried: Q_DECLARATIVE_METATYPE in and out Using EventExport vs. const EventExport& in signal and slot profiles Sending empty…
Rich Bair
  • 21
  • 1
0
votes
1 answer

Modal QProgressDialog::setValue() causes crash by nested event loop

I just wrote some QThread based code that executes a big calculation. To visualize the progress I need to open a QProgressDialog. The dialog is application modal (using open()) since I do not want to allow modifications of the main window during…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
0
votes
1 answer

Registering types vs containers

If I register a custom type like the following, for the use in queued connections: Q_DECLARE_METATYPE(MyClass); qRegisterMetaType(); I can use the type in queued connection with signals like this one: void MySignal(MyType o); Now I also…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
0
votes
0 answers

PyQt QueuedConnection sometimes works

I have an application using QThreads. I am adding different methods to a queued connection and they are run in that sequence. This has been working very well. But the depending on the order of the tests (sequence can be in any order) my application…
climbx5
  • 85
  • 1
  • 8
0
votes
2 answers

singleHow does Qt::QueuedConnection work in a single thread application?

I'm doing: connect(tcpSocket,SIGNAL(readyRead()), this, SLOT(onTCPDataArrived()), Qt::QueuedConnection); But the times the slot gets called is much less than it should have. It seems like it missed a lot of signals, probably because the slot takes…
user3528438
  • 2,737
  • 2
  • 23
  • 42