The QAxObject class provides a QObject 包裹 COM (组件对象模型) 对象。 更多...
头: | #include <QAxObject> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS AxContainer)
target_link_libraries(mytarget PRIVATE Qt6::AxContainer) |
qmake: | QT += axcontainer |
继承: | QAxBaseObject and QAxBase |
继承者: | QAxScriptEngine |
QAxObject (QObject * parent = nullptr) | |
QAxObject (const QString & c , QObject * parent = nullptr) | |
QAxObject (IUnknown * iface , 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 框架 .
[explicit]
QAxObject::
QAxObject
(
QObject
*
parent
= nullptr)
创建空 COM 对象并传播 parent 到 QObject constructor. To initialize the object, call setControl().
另请参阅 setControl() .
[explicit]
QAxObject::
QAxObject
(const
QString
&
c
,
QObject
*
parent
= nullptr)
Creates a QAxObject that wraps the COM object c . parent 被传播给 QObject 构造函数。
另请参阅 setControl() .
[explicit]
QAxObject::
QAxObject
(
IUnknown
*
iface
,
QObject
*
parent
= nullptr)
Creates a QAxObject that wraps the COM object referenced by iface . parent 被传播给 QObject 构造函数。
[override virtual]
QAxObject::
~QAxObject
()
释放 COM 对象并销毁 QAxObject ,清理所有分配资源。
[override virtual protected]
void
QAxObject::
connectNotify
(const
QMetaMethod
&
signal
)
重实现: QObject::connectNotify (const QMetaMethod &signal).
请求 COM 对象以履行动作 verb 。可能的 verb 的返回是通过 verbs ().
函数返回 true 若对象能履行动作,否则返回 false。