#ifndef __PLUGINLOADER_H__
#define __PLUGINLOADER_H__

#include <QObject>
#include <QPluginLoader>
#include <QDesignerCustomWidgetInterface>

class PluginLoader : public QObject
{
    Q_OBJECT

public:
    explicit PluginLoader(QString fileName, QObject *parent = nullptr);
    ~PluginLoader(); 

    bool load();
    bool unload();
    bool isLoaded() const;
    const QObject* instance();
    QString fileName() const;
    QString errorString() const;
    QList<QDesignerCustomWidgetInterface *> customWidgets() const;

private:
    QPluginLoader *m_pLoader;
    QList<QDesignerCustomWidgetInterface*> m_customWidgets;    // 插件控件列表

};

#endif  // PLUGINLOADER_H