Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>pull/2414/head
parent
ae532c807c
commit
a9258923fa
8 changed files with 69 additions and 11 deletions
@ -0,0 +1,7 @@ |
||||
#include "plugin.h" |
||||
#include <QFile> |
||||
|
||||
QString plugin1::getResource() |
||||
{ |
||||
return "hello world"; |
||||
} |
@ -0,0 +1,11 @@ |
||||
#pragma once |
||||
#include <plugin_if.h> |
||||
|
||||
class plugin1:public QObject,public PluginInterface |
||||
{ |
||||
Q_OBJECT |
||||
Q_INTERFACES(PluginInterface) |
||||
Q_PLUGIN_METADATA(IID "demo.PluginInterface" FILE "plugin.json") |
||||
public: |
||||
QString getResource() override; |
||||
}; |
@ -0,0 +1,3 @@ |
||||
{ |
||||
"name" : "Plugin1" |
||||
} |
@ -0,0 +1,21 @@ |
||||
#ifndef PLUGIN_IF_H |
||||
#define PLUGIN_IF_H |
||||
|
||||
#include <QString> |
||||
#include <QtPlugin> |
||||
|
||||
/**
|
||||
* @brief Interface for a plugin |
||||
*/ |
||||
class PluginInterface |
||||
{ |
||||
public: |
||||
virtual ~PluginInterface() = default; |
||||
|
||||
/// Initializes the plugin
|
||||
virtual QString getResource() = 0; |
||||
}; |
||||
|
||||
Q_DECLARE_INTERFACE(PluginInterface, "demo.PluginInterface") |
||||
|
||||
#endif |
Loading…
Reference in new issue