Important: Please read the Qt Code of Conduct -

Questions about plugin interfaces

  • Hi,
    I have two questions regarding the plugin interfaces I'd really like to answer. :-)

    1. Why is it often said that QObject is not supported in the interface? Signals and slots are very useful in interfaces and they can be easily declared there when the interface inherit from QObject. I understand that it makes the interface dependant on non-abstract class therefore requiring it to be present wherever it is used but I do not find it to be a drawback in project that is dependant on Qt libraries already. So is there any good reason not to use QObject in plugin interface? And if yes, is there a sensible way of getting signals and slots with plugins other than a) fooling around with meat object system or b) knowing other headers from the plugin having signals and slots?

    2. I could not get inherited interface to work. Is there a way for an interface to inherit from another interface / abstract class? I have a situation where several plugins would share part of an interface but would add some of their specific stuff to interface as well. How should the multiple interfaces inheritance be declared if it is possible?


  • Lifetime Qt Champion


    Answer to number 1 comes partly from number 2, You can't implement a plugin implementing multiple interfaces if theses interfaces inherits from QObject.

Log in to reply