QAxBindable Class
QAxBindable クラスは、QWidget と ActiveX クライアントの間のインターフェイスを提供します。詳細...
ヘッダー | #include <QAxBindable> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS AxServer) target_link_libraries(mytarget PRIVATE Qt6::AxServer) |
qmake: | QT += axserver |
パブリック関数
QAxBindable() | |
virtual | ~QAxBindable() |
virtual QAxAggregated * | createAggregate() |
virtual bool | readData(QIODevice *source, const QString &format) |
void | reportError(int code, const QString &src, const QString &desc, const QString &context = QString()) |
virtual bool | writeData(QIODevice *sink) |
保護された関数
IUnknown * | clientSite() const |
void | propertyChanged(const char *property) |
bool | requestPropertyChange(const char *property) |
詳細説明
このクラスが提供する関数は、ActiveXコントロールがプロパティの変更をクライアントアプリケーションに伝えることを可能にします。このクラスの関数にアクセスするには、QWidget (直接または間接的に)とこのクラスの両方からコントロール・クラスを継承します。Meta-Object Compilerでは、最初にQWidget を継承する必要があります。
class MyActiveX : public QWidget, public QAxBindable { Q_OBJECT Q_PROPERTY(int value READ value WRITE setValue) public: MyActiveX(QWidget *parent = 0); ... int value() const; void setValue(int); };
プロパティ書き込み関数を実装する場合は、requestPropertyChange ()を使用して、ActiveX クライアント・アプリケーションからこのプロパティを変更する許可を取得します。プロパティが変更されたら、propertyChanged() を呼び出して、ActiveX クライアント・アプリケーションに変更を通知します。コントロールで致命的なエラーが発生した場合は、静的なreportError() 関数を使用してクライアントに通知します。
clientSite() が返すインタフェースを使用して、ActiveX クライアントを呼び出します。ActiveX コントロールに追加の COM インタフェースを実装するには、createAggregate() を再実装して、QAxAggregated サブクラスの新しいオブジェクトを返します。
QAxAggregated 、QAxFactory 、ActiveQt Frameworkも参照してください 。
メンバ関数のドキュメント
QAxBindable::QAxBindable()
空の QAxBindable オブジェクトを構築します。
[virtual noexcept]
QAxBindable::~QAxBindable()
QAxBindable オブジェクトを破棄する。
[protected]
IUnknown *QAxBindable::clientSite() const
この ActiveX オブジェクトのクライアント・サイト・インターフェイスへのポインタを返します。
呼び出したいインタフェースを取得するには、返されたインタフェースでQueryInterface()
を呼び出します。
[virtual]
QAxAggregated *QAxBindable::createAggregate()
ActiveXコントロールにCOMインタフェースを追加実装する場合や、COMインタフェースの代替実装を提供する場合に、この関数を再実装します。QAxAggregated サブクラスの新しいオブジェクトを返します。
デフォルトの実装では、NULL ポインタを返します。
[protected]
void QAxBindable::propertyChanged(const char *property)
この関数をコールして、このActiveXコントロールをホストしているクライアントに、プロパティproperty が変更されたことを通知する。
この関数は通常、プロパティの書き込み関数の最後で呼び出されます。
requestPropertyChange()も参照してください 。
[virtual]
bool QAxBindable::readData(QIODevice *source, const QString &format)
COM オブジェクトが MIME タイプをサポートしている場合、この関数はformat のデータsource から COM オブジェクトを初期化するために呼び出される。source から読み込む前に、読み込み用に を開く必要がある。
成功した場合はtrueを返す。この関数がfalseを返した場合、ActiveQtはメタ・オブジェクト・システムを通してプロパティを設定し、データを処理します。
この関数を再実装する場合は、writeData ()も実装する必要があります。デフォルトの実装は何もせず、falseを返します。
警告 HTMLに埋め込まれたActiveXコントロールは、object
タグのtype
属性とdata
属性を使用してデータを読み取るか、param
タグのリストを使用してプロパティを初期化することができます。param
タグを使用する場合、Internet Explorerはdata
属性を無視し、readDataは呼び出されません。
writeData()も参照 。
void QAxBindable::reportError(int code, const QString &src, const QString &desc, const QString &context = QString())
code 。クライアント・アプリケーションにエラーを報告する。desc 。src 。エラーの発生源の名前であり、通常はActiveXサーバー名である。context 。エラーに関する詳細情報を含むヘルプファイルの場所を指定することもできる。context の末尾が[12]などの括弧内の数字で終わっている場合、この数字はヘルプファイル内のコンテキストIDと解釈されます。
[protected]
bool QAxBindable::requestPropertyChange(const char *property)
この関数をコールして、ActiveX コントロールをホストしているクライアントにプロパティproperty の変更許可を要求する。クライアントが変更を許可している場合はtrueを返し、そうでない場合はfalseを返す。
この関数は通常、property の書き込み関数で最初に呼び出され、false を返した場合は書き込みが中止されます。
void MyActiveQt::setText(const QString &text) { if (!requestPropertyChange("text")) return; // update property propertyChanged("text"); }
propertyChanged()も参照 。
[virtual]
bool QAxBindable::writeData(QIODevice *sink)
COM オブジェクトが MIME タイプをサポートしている場合、この関数は COM オブジェクトをsink に格納するために呼び出される。書き込みを行う前に、sink を書き込み用にオープンする必要がある。
成功した場合は true を返します。この関数が false を返した場合、ActiveQt はプロパティ値を格納してオブジェクトをシリアライズします。
この関数を再実装する場合は、readData ()も実装する必要があります。デフォルトの実装は何もせず、false を返します。
readData()も参照してください 。
© 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.