QAxObject Class

QAxObject 类提供 QObject that wraps a COM object. 更多...

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

QAxScriptEngine

公共函数

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

重实现保护函数

virtual void connectNotify (const QMetaMethod & signal )

额外继承成员

详细描述

QAxObject 类提供 QObject that wraps a COM object.

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 interface, the properties, methods and events of that object become available as Qt properties, slots and signals. The base class, QAxBase , provides an API to access the COM object directly through the IUnknown pointer.

QAxObject QObject and can be used as such, e.g. it can be organized in an object hierarchy, receive events and connect to signals and slots.

QAxObject 还继承了其 ActiveX 相关的大部分功能从 QAxBase ,尤其 dynamicCall () 和 querySubObject ().

警告: 可以子类化 QAxObject ,但无法使用 Q_OBJECT 宏在子类中 (不会编译生成的 moc 文件),所以,无法进一步添加信号、槽或特性。此局限性是由在运行时,生成的元对象信息造成的。要解决此问题,聚合 QAxObject 作为成员对于 QObject 子类。

另请参阅 QAxBase , QAxWidget , QAxScript ,和 ActiveQt 框架 .

成员函数文档编制

QAxObject:: QAxObject ( QObject * parent = Q_NULLPTR)

Creates an empty COM object and propagates parent QObject constructor. To initialize the object, call setControl .

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

创建 QAxObject that wraps the COM object c . parent is propagated to the QObject 构造函数。

另请参阅 setControl ().

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

创建 QAxObject 包裹引用 COM 对象通过 iface . parent is propagated to the QObject 构造函数。

QAxObject:: ~QAxObject ()

Releases the COM object and destroys the QAxObject , cleaning up all allocated resources.

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

重实现自 QObject::connectNotify ().

bool QAxObject:: doVerb (const QString & verb )

Requests the COM object to perform the action verb . The possible verbs are returned by verbs ().

The function returns true if the object could perform the action, otherwise returns false.

该函数在 Qt 4.1 引入。