I use Qt 5.3 and when calling
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
bool pluginLoaded = pluginLoader.isLoaded();
It gives false :(
// serverplugin.h
#ifndef SERVERPLUGIN_H
#define SERVERPLUGIN_H
#include <QObject>
#include <QtPlugin>
#include "acepos/aceclient/serverinterface.h"
#include <QThread>
#include "server.h"
class ServerPlugin : public QObject,
public ServerInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.AcePos.ServerInterface/1.1" FILE "serverplugin.json")
Q_INTERFACES(ServerInterface)
QThread *m_pServerThread;
Server *m_pServer;
public:
ServerPlugin():m_pServerThread(NULL), m_pServer(NULL){}
private slots:
//void handleServiceStartNotify();
public:
bool startServerService();
bool stopServerService();
};
#endif
// serverinterface.h
#ifndef SERVERINTERFACE_H
#define SERVERINTERFACE_H
#include <QtPlugin>
class ServerInterface
{
public:
virtual ~ServerInterface() { }
virtual bool startServerService() = 0;
virtual bool stopServerService() = 0;
};
#define ServerInterface_iid "org.qt-project.Qt.AcePos.ServerInterface/1.1"
Q_DECLARE_INTERFACE(ServerInterface, ServerInterface_iid)
#endif // SERVERINTERFACE_H
Please let me know if anything wrong im doing in creating plugin.
When I build the plugin project I am able to see the generated library file. I am doing this for android qt project. When debugging it works fine. I had made changes in the plugin part during development.