pluginloader.h 676 B

123456789101112131415161718192021222324252627282930
  1. #ifndef __PLUGINLOADER_H__
  2. #define __PLUGINLOADER_H__
  3. #include <QObject>
  4. #include <QPluginLoader>
  5. #include <QDesignerCustomWidgetInterface>
  6. class PluginLoader : public QObject
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit PluginLoader(QString fileName, QObject *parent = nullptr);
  11. ~PluginLoader();
  12. bool load();
  13. bool unload();
  14. bool isLoaded() const;
  15. const QObject* instance();
  16. QString fileName() const;
  17. QString errorString() const;
  18. QList<QDesignerCustomWidgetInterface *> customWidgets() const;
  19. private:
  20. QPluginLoader *m_pLoader;
  21. QList<QDesignerCustomWidgetInterface*> m_customWidgets; // 插件控件列表
  22. };
  23. #endif // PLUGINLOADER_H