Op 20/09/2016 om 22:09 schreef Alejandro Exojo:
On Monday 19 September 2016 18:35:43 Etienne Sandré-Chardonnal wrote:
Yes, but for instance you can't move-pass an object between signals and
slots across a queued connection, unless I'm wrong. You have to make your
object implicitely shared. This causes lots of copies when passing a
std::vector, for instance.
The Qt style on designing signals, is to use those for indicating that
something happened, but not passing the something in the signal. For example,
you get a signal that new data is available (e.g. a datagram), but you don't
get the datagram passed as signal argument.
You don't? Well, you can certainly get a pointer to it (which is cheap, of course)...
See QNetworkAccessManager::finished(QNetworkReply *reply); [signal]

I would say that it is quite normal to signal the finishing of some operation _and_ directly pass along the results of that operation. If that is a std::vector, then indeed it would result in copying (so I'd go looking for a different design there, perhaps use a QVector instead).


Interest mailing list

Reply via email to