Compare commits

..

2 Commits

Author SHA1 Message Date
00dbf4485a Implement interfaces(). 2023-11-17 13:44:45 +01:00
88670c1079 Add CLASSINFO() to enumerate supported interfaces. 2023-11-17 13:44:16 +01:00
4 changed files with 16 additions and 1 deletions

View File

@@ -181,6 +181,16 @@ void ATBVMCPlugin::reset() {
}
QStringList ATBVMCPlugin::interfaces() const {
QStringList result;
int const count = this->metaObject()->classInfoCount();
for (int i = 0; i < count; ++i) {
QString const info(QString::fromLatin1(this->metaObject()->classInfo(i).value()));
if (info == "Interface")
result << info;
}
return result;
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(ATBVMCPlugin, ATBVMCPlugin)

View File

@@ -15,6 +15,7 @@ class ATBVMCPlugin : public VMCInterface {
Q_OBJECT
Q_INTERFACES(VMCInterface)
Q_CLASSINFO("Interface", "VMCInterface")
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "eu.atb.ptu.plugin.ATBVMCPlugin")
@@ -42,6 +43,8 @@ public:
// helpers e.g. for debug / log
virtual QString const &getString(RESULT_STATE resultState) override;
QStringList interfaces() const;
public slots:
virtual void onChangedProgramModeToSELL() override;
virtual void onChangedProgramModeToSERVICE() override;

View File

@@ -14,6 +14,7 @@
class UnifiedDCVMCInterface : public ATBAPPplugin {
Q_INTERFACES(ATBAPPplugin)
Q_CLASSINFO("Interface", "ATBAPPplugin")
public:
explicit UnifiedDCVMCInterface() = default;

View File

@@ -21,7 +21,8 @@ class VMCInterface : public QObject, public UnifiedDCVMCInterface {
Q_OBJECT
Q_INTERFACES(ATBAPPplugin UnifiedDCVMCInterface)
Q_CLASSINFO("Interface", "ATBAPPplugin")
Q_CLASSINFO("Interface", "UnifiedDCVMCInterface")
public:
explicit VMCInterface(QObject *parent = nullptr) : QObject(parent) {}