P
P
Pavel K2014-01-07 22:45:23
Qt
Pavel K, 2014-01-07 22:45:23

Signals between plugins

Good afternoon.
I build in the application the ability to connect plugins.
The question arose of how to beautifully implement for plugins:
1. The ability to connect your signal with the slot of another plugin
2. The ability to connect your slot with the signal of another plugin
3. From one plugin, connect the signal of the second plugin and the slot of the third plugin.
Taking into account the fact that the parent application does not know anything about the signals / slots of its plugins, except for those pre-set in the "interface".
It simply calls its signals, plugins should react to them.
There are no problems with the event connection between the plugin application, but there is a plugin-plugin.
As I thought:
Or create a separate class through which plugins could declare their slots / signals and connect whoever wants by string names, but in Qt you cannot connect a slot and a signal that is not predefined in the class.
Or give all plugins a list of other plugins and they would make a connection using standard means.
But I don't like it that way.
Or override qt_metacall. But laziness.
Ideally, I see the interaction like this (simplified):
addAction("HelloWorld", this, slotHelloWorld ); //-- bound the signal and its own slot
doAction("HelloWorld"); //-- a signal was emitted somewhere
How to make it the most beautiful?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel K, 2014-01-07
@PavelK

I did it ideally with the help of doc.qt.digia.com/qq/qq16-dynamicqobject.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question