QGenericPlugin Class

QGenericPluginクラスはプラグインの抽象基底クラスです。詳細...

ヘッダー #include <QGenericPlugin>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
継承: QObject

パブリック関数

QGenericPlugin(QObject *parent = nullptr)
virtual ~QGenericPlugin()
virtual QObject *create(const QString &key, const QString &specification) = 0

詳しい説明

マウスプラグインは QGenericPlugin をサブクラス化し、純粋な仮想関数create() を再実装することで作成できます。Q_PLUGIN_METADATA() マクロを使用して派生クラスをエクスポートすることで、QGenericPluginFactory クラスのデフォルト実装が自動的にプラグインを検出し、実行時にサーバアプリケーションにドライバをロードします。詳細はQt プラグインの作成方法を参照してください。

jsonメタデータ・ファイルには、このプラグインがサポートするキーのリストを含める必要があります。

QGenericPluginFactoryも参照してください

メンバ関数のドキュメント

[explicit] QGenericPlugin::QGenericPlugin(QObject *parent = nullptr)

与えられたparent でプラグインを構築します。

このコンストラクタはプラグインをエクスポートするmoc生成コードによって自動的に呼び出されるので、明示的に呼び出す必要はないことに注意してください。

[virtual noexcept] QGenericPlugin::~QGenericPlugin()

プラグインを破棄します。

Qtはプラグインが使われなくなると自動的に破棄するので、明示的にデストラクタを呼び出す必要はないことに注意してください。

[pure virtual] QObject *QGenericPlugin::create(const QString &key, const QString &specification)

この関数を実装して、与えられたkeyspecification パラメータで指定されたタイプにマッチするドライバを作成する。キーの大文字と小文字は区別されない。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.