Best way to send global notifications to my application ?
I have some global events in my application (when some state/property change and all classes need to be notified) but I'm not sure what's the best way to notify them with Qt:
-sendEvent/postEvent does not allow sending an event to all QObject classes, you have to specify which QObject class you want to send the event to
-signals/slots need to be manually connected to each and every parent/child/child of child/brother/cousin classes that needs to receive notifications, so it looks like a big plate of spaghetti... I'm not quite sure what would be the best architecture in this case
-Is there any other way I'm not aware of ?
do you really need to send an event to all your objects? seems a little weird to me. I guess we need to know a little bit more about your application, maybe there is another way instead of 500 signal/slot connection :D
It's a paint application with different image layers (think of Photoshop).
I have common project properties like project format, list of layers, etc..
There are event such as "LayerContentChanged" which can be triggered either by the class dedicated to image filtering, image painting, layer list manager... and every class dealing with theses layers (either classes processing thoses layers or just reading its content for display) must be notified of it.
What would you suggest ?