QAxAggregated Class
La clase QAxAggregated es una clase base abstracta para implementaciones de interfaces COM adicionales. Más...
| Cabecera: | #include <QAxAggregated> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS AxServer)target_link_libraries(mytarget PRIVATE Qt6::AxServer) |
| qmake: | QT += axserver |
Funciones Públicas
| virtual long | queryInterface(const QUuid &iid, void **iface) = 0 |
Funciones protegidas
| virtual | ~QAxAggregated() |
| IUnknown * | controllingUnknown() const |
| QObject * | object() const |
| QWidget * | widget() const |
Descripción Detallada
Crea una subclase de QAxAggregated y reimplementa queryInterface() para soportar interfaces COM adicionales. Utilizar herencia múltiple de esas interfaces COM. Implementa la interfaz IUnknown de esas interfaces COM delegando las llamadas a QueryInterface(), AddRef() y Release() a la interfaz proporcionada por controllingUnknown().
Utilice el método widget() si necesita realizar llamadas al QWidget que implementa el control ActiveX. No debe almacenar ese puntero en su subclase (a menos que utilice QPointer), ya que el QWidget puede ser destruido por el marco ActiveQt en cualquier momento.
Véase también QAxBindable, QAxFactory, y Active Qt.
Documentación de funciones miembro
[virtual constexpr noexcept protected] QAxAggregated::~QAxAggregated()
El destructor es llamado internamente por Qt.
[protected] IUnknown *QAxAggregated::controllingUnknown() const
Devuelve la interfaz IUnknown del control ActiveX. Implemente la interfaz IUnknown en su subclase QAxAggregated para delegar las llamadas a QueryInterface(), AddRef(), y Release() a la interfaz proporcionada por esta función.
HRESULT AxImpl::QueryInterface(REFIID iid, void **iface) { return controllingUnknown()->QueryInterface(iid, iface); } ulong AxImpl::AddRef() { return controllingUnknown()->AddRef(); } ulong AxImpl::Release() { return controllingUnknown()->Release(); }
En lugar de declarar e implementar estas tres funciones manualmente, puede utilizar la macro QAXAGG_IUNKNOWN en la declaración de clase de su subclase.
[protected] QObject *QAxAggregated::object() const
Devuelve un puntero a la subclase QObject que implementa el objeto COM. Esta función puede devolver 0.
Advertencia: No debe almacenar el puntero devuelto, a menos que utilice un QPointer, ya que el QObject puede ser destruido por ActiveQt en cualquier momento.
[pure virtual] long QAxAggregated::queryInterface(const QUuid &iid, void **iface)
Reimplemente esta función virtual pura para soportar interfaces COM adicionales. Establezca el valor de iface para que apunte a este objeto para soportar la interfaz iid. Tenga en cuenta que debe asignar el puntero this a la superclase apropiada.
long AxImpl::queryInterface(const QUuid &iid, void **iface) { *iface = 0; if (iid == IID_ISomeCOMInterface) *iface = (ISomeCOMInterface*)this; else return E_NOINTERFACE; AddRef(); return S_OK; }
Devuelve los resultados COM estándar S_OK (la interfaz está soportada) o E_NOINTERFACE (la interfaz solicitada no está soportada).
Advertencia: Aunque debe implementar la interfaz IUnknown si implementa cualquier interfaz COM no debe soportar la interfaz IUnknown en su implementación de queryInterface().
[protected] QWidget *QAxAggregated::widget() const
Devuelve un puntero a la subclase QWidget que implementa el control ActiveX. Esta función puede devolver 0.
© 2026 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.