Unsolved Connect Prototype help
-
Hi,
Depending on your goal with that, did you consider using some meta object programming ?
-
@SGaist , please tell me more...
-
It's all in the link ;-)
The idea is that you can use introspection of your QObject based classes. You can get all the signals of your class, or go upper the chain and get the signals of the base classe (for as many class as your hierarchy has). Then you can use the various QMetaXXX classes to do what you want.
-
Ok, to summarise, what I want to do is reduce all signal and slot connections to a single connect call and then manage the details of the signal in the lambda slot.
-
You can't have only one connect statement. However with the introspection, you can loop on the signals to connect them to the same lambda.
However there's one issue that you are going to have: signals will have different parameters, how are you going to manage that in your lambda ?
-
@SGaist , sorry thats really what I meant, I would have a single map in my application where my derived Qt control classes register they're signals and then that map will be processed after reading the configuration from XML files where the subscribers will be defined. The subscribers (slots) will be connected to the signals using a common function. From what I've seen so far, having different parameters isn't a problem.
-
Some sort of configurable pub/sub design ?
-
@SGaist , absolutely, everything I'm working towards will take Qt into a new era, where once the engine is complete, you will only need to have the same engine for each platform you want to run on, but the actual application will be a series of XML files and JavaScript files.
-
Then you will have to go with introspection.
-