Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Creating Plugin Interface Inheriting QObject Issue



  • Hi friends,

    I am trying to make a plugin and I am stuck a little.

    I need to implement signals and slots in the interface and to do that I must inherent QObject.

    In the plugin implementation I inherit another class that also inherits QObject. When I do this I get an error about an ambiguous base regarding QObject.

    Does anyone have some tips how to get around this issue?

    Thank you
    -Shawn


  • Lifetime Qt Champion

    Hi,

    The thing to do is to not make your interface inherit QObject. It's an interface, it should not be a specific object type.



  • I agree with you except that I want to retain the signals and slots. In order to add signals and slots to the interface I think I am forced to inherit QObject.

    As I thought about it in the car I realized that I only need to inherit the interface anyways, and not the other QtClass, since I can simply create an instance of the class and use it, not expand its functionality.


  • Qt Champions 2017

    Without inheriting qobjecy u just do everything. While connect ing do connect to qobject itself. Your signals and slots will work.


Log in to reply