I'm working on a multi-threaded Qt application and would like to connect a signal in a thread with slot in another thread. My problem is that I only have the string used to set the QObject:objectName
in the signaling thread that is defined in a project wide constants file.
My overall goal is to avoid having to pass pointers to objects that are several layers deep inside of other objects. I've done this in the past and while it works, it adds much unneeded complexity to code. And it is a very un-elegant solution to the problem.
What I would like to do is to do a global search through all of the QObjects in my application to find the one that matches the name. In reading the Qt documentation, there is considerable discussion about how to search for child objects of the current one or you can search using parent classes. But with objects in different threads, this doesn't appear to work. In particular, as the object doing the connection does not have a direct access to the QThread that owns the object doing the signaling.
Any suggestions?