Page 1 of 1
Signal to signal
Posted: Sat Aug 29 2020 11:21 am
by baraujo
Does CopperSpice support signal to signal?
Re: Signal to signal
Posted: Sun Aug 30 2020 2:52 am
by barbara
Yes, you can call connect() and have the signal and slot both refer to a signal.
This syntax is not valid:
Code: Select all
connect( sender, SIGNAL(someSignal()), this, SIGNAL(mySignal()) );
You can use this syntax:
Code: Select all
connect( sender, SIGNAL(someSignal()), this, SLOT(mySignal()) );
However we strongly suggest using method pointers:
Code: Select all
connect( sender, &SenderClass::someSignal, this, &MyClass:: mySignal );
Re: Signal to signal
Posted: Wed Sep 02 2020 8:29 pm
by baraujo
When across threads are they queued automatically like in Qt?
Re: Signal to signal
Posted: Thu Sep 03 2020 6:12 pm
by ansel
baraujo wrote: ↑Wed Sep 02 2020 8:29 pm
When across threads are they queued automatically like in Qt?
If I understand your question correctly, you are asking about the behavior when the sender and receiver belong to different threads. We can not confirm that this actually works in Qt, as we observed some undefined behavior in the signal/slot delivery system.
In CopperSpice, if you look at the different overloads for connect() in the QObject class, you will see that the default for the connection type is Qt::AutoConnection. An AutoConnection will automatically queue signals if the sender and receiver are in different threads.
https://www.copperspice.com/docs/cs_api/class_qobject.html
Let us know if you have more questions about connections.
Re: Signal to signal
Posted: Sat Apr 17 2021 1:08 pm
by baraujo
Cool. Sounds good. Thanks for the info.
Thanks for CopperSpice. I think many people might change now since Qt is going so commercial and very expensive.