QAxObject Class Reference

[ QAxContainer module]

The QAxObject class provides a QObject that wraps a COM object. 更多...

继承 QObject and QAxBase .

方法


详细描述

The QAxObject class provides a 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 实现 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 is a 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 also inherits most of its ActiveX-related functionality from QAxBase , notably 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 子类。


方法文档编制

QAxObject.__init__ ( self , QObject   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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

QAxObject.__init__ ( self , QString, QObject   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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

另请参阅 setControl ().

QAxObject.connectNotify ( self , str)

重实现自 QObject.connectNotify ().

bool QAxObject.doVerb ( self , QString)

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

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

该函数在 Qt 4.1 引入。