QAxAggregated Class
The QAxAggregated class is an abstract base class for implementations of additional COM interfaces. More...
Header: | #include <QAxAggregated> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS AxServer) target_link_libraries(mytarget PRIVATE Qt6::AxServer) |
qmake: | QT += axserver |
Protected Functions
virtual | ~QAxAggregated() |
IUnknown * | controllingUnknown() const |
int * | object() const |
Detailed Description
Create a subclass of QAxAggregated and reimplement queryInterface() to support additional COM interfaces. Use multiple inheritance from those COM interfaces. Implement the IUnknown interface of those COM interfaces by delegating the calls to QueryInterface()
, AddRef()
and Release()
to the interface provided by controllingUnknown().
Use the widget() method if you need to make calls to the QWidget implementing the ActiveX control. You must not store that pointer in your subclass (unless you use QPointer), as the QWidget can be destroyed by the ActiveQt framework at any time.
See also QAxBindable, QAxFactory, and Active Qt.
Member Function Documentation
[virtual constexpr noexcept protected]
QAxAggregated::~QAxAggregated()
The destructor is called internally by Qt.
[protected]
IUnknown *QAxAggregated::controllingUnknown() const
Returns the IUnknown
interface of the ActiveX control. Implement the IUnknown
interface in your QAxAggregated subclass to delegate calls to QueryInterface()
, AddRef()
, and Release()
to the interface provided by this function.
HRESULT AxImpl::QueryInterface(REFIID iid, void **iface) { return controllingUnknown()->QueryInterface(iid, iface); } ulong AxImpl::AddRef() { return controllingUnknown()->AddRef(); } ulong AxImpl::Release() { return controllingUnknown()->Release(); }
Instead of declaring and implementing these three functions manually, you can use the QAXAGG_IUNKNOWN
macro in the class declaration of your subclass.
[protected]
int *QAxAggregated::object() const
Returns a pointer to the QObject subclass implementing the COM object. This function might return 0.
© 2024 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.