QAxObject 類

The QAxObject class provides a QObject 包裹 COM (組件對象模型) 對象。 更多...

頭: #include <QAxObject>
qmake: QT += axcontainer
繼承: QObject and QAxBase
繼承者:

QAxScriptEngine

公共函數

QAxObject (IUnknown * iface , QObject * parent = nullptr)
QAxObject (const QString & c , QObject * parent = nullptr)
QAxObject (QObject * parent = nullptr)
virtual ~QAxObject () override
bool doVerb (const QString & verb )

重實現保護函數

virtual void connectNotify (const QMetaMethod & signal ) override

詳細描述

A QAxObject can be instantiated as an empty object, with the name of the COM object it should wrap, or with a pointer to the IUnknown that represents an existing COM object. If the COM object implements the IDispatch 接口,該對象的特性、方法和事件將變為可用 Qt 特性、槽及信號。基類 QAxBase 提供能透過 IUnknown 指針直接訪問 COM 對象的 API。

QAxObject is a QObject 且可以這樣使用,如:可以按對象層次結構、接收事件及連接信號/槽組織它。

QAxObject also inherits most of its ActiveX-related functionality from QAxBase ,顯而易見 dynamicCall () 和 querySubObject ().

警告: You can subclass QAxObject, but you cannot use the Q_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxObject as a member of the QObject 子類。

另請參閱 QAxBase , QAxWidget , QAxScript ,和 ActiveQt 框架 .

成員函數文檔編製

QAxObject:: QAxObject ( IUnknown * iface , QObject * parent = nullptr)

Creates a QAxObject that wraps the COM object referenced by iface . parent 被傳播給 QObject 構造函數。

QAxObject:: QAxObject (const QString & c , QObject * parent = nullptr)

Creates a QAxObject that wraps the COM object c . parent 被傳播給 QObject 構造函數。

另請參閱 setControl ().

QAxObject:: QAxObject ( QObject * parent = nullptr)

創建空 COM 對象並傳播 parent QObject 構造函數。以初始化對象,調用 setControl .

[override virtual] QAxObject:: ~QAxObject ()

釋放 COM 對象並銷毀 QAxObject ,清理所有分配資源。

[override virtual protected] void QAxObject:: connectNotify (const QMetaMethod & signal )

重實現: QObject::connectNotify (const QMetaMethod &signal).

bool QAxObject:: doVerb (const QString & verb )

請求 COM 對象以履行動作 verb 。可能的 verb 的返迴是通過 verbs ().

函數返迴 true 若對象能履行動作,否則返迴 false。

該函數在 Qt 4.1 引入。