@JonB said in Passing QObjects across threads via signals and slots:
does this mean in practice that you cannot pass a QObject from a signal to a slot?
Yes, you can. QNetworkAccessManager::finished(QNetworkReply*) is one such signal; QNetworkReply is a QObject.
Since you are all saying that neither & nor * are good for QObject across threads
Hold up. Take a deep breath. Let's untangle things a bit.
You cannot use const QObject& as a signal/slot argument between threads, ever. Because QObjects are not copyable.
You can use QObject* as a signal/slot argument between threads. @Christian-Ehrlicher and @mrjj did not say it's not allowed; they said it's dangerous.
I am getting very lost now. Because when people ask "how do I pass the widget which caused a signal to the slot if that's what I need to do" one of the possible answers we give is "write a lambda which accepts the widget as an extra parameter", like:
connect(checkbox, &QCheckBox::pressed, that, [checkbox]() { qDebug() << checkbox; });
Well, there's no multithreading here. So it's not dangerous.