[Interest] How to upgrade plugin base class with Q_DECLARE_INTERFACE

Taras Kushnir tk.dev at mailbox.org
Wed May 18 07:19:03 CEST 2022


I'm implementing a plugin system within my Qt desktop app using a base 
class MyBasePluginClass, which has 
Q_DECLARE_INTERFACE(MyBasePluginClass, "MyBasePluginClass/v1.0") and a 
bunch of plugins that inherit from that interface and override certain 
virtual methods.

Now in the next release of my app I need to make some non-compatible 
changes to MyBasePluginClass for new plugins and stay 
backward-compatible with my old plugins at the same time. How to achieve 

In other words, what is the best way to do such upgrades? Create a fully 
new class which will declare interface "MyBasePluginClass/v2.0" and then 
I will qobject_cast<> it to see which interface does the plugin 
implement or I need to subclass my v2 version of the class from previous?

I did not find such examples in Qt documentation.

Thanks in advance,

More information about the Interest mailing list