Qt 4.8
Public Functions | Protected Functions | Properties | Friends | List of all members
QAxAggregated Class Referenceabstract

The QAxAggregated class is an abstract base class for implementations of additional COM interfaces. More...

#include <qaxaggregated.h>

Public Functions

virtual long queryInterface (const QUuid &iid, void **iface)=0
 Reimplement this pure virtual function to support additional COM interfaces. More...
 

Protected Functions

IUnknown * controllingUnknown () const
 Returns the IUnknown interface of the ActiveX control. More...
 
QObjectobject () const
 Returns a pointer to the QObject subclass implementing the COM object. More...
 
QWidgetwidget () const
 Returns a pointer to the QWidget subclass implementing the ActiveX control. More...
 
virtual ~QAxAggregated ()
 The destructor is called internally by Qt. More...
 

Properties

IUnknown * controlling_unknown
 
QObjectthe_object
 

Friends

class QAxClientSite
 
class QAxServerBase
 

Detailed Description

The QAxAggregated class is an abstract base class for implementations of additional COM interfaces.

Attention
Module: QAxServer

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, {Qt's ActiveX Framework (ActiveQt)}

Definition at line 58 of file qaxaggregated.h.

Constructors and Destructors

◆ ~QAxAggregated()

QAxAggregated::~QAxAggregated ( )
inlineprotectedvirtual

The destructor is called internally by Qt.

Definition at line 66 of file qaxaggregated.h.

67  {}

Functions

◆ controllingUnknown()

IUnknown * QAxAggregated::controllingUnknown ( ) const
inlineprotected

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();
}
{
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.

Definition at line 69 of file qaxaggregated.h.

70  { return controlling_unknown; }
IUnknown * controlling_unknown
Definition: qaxaggregated.h:78

◆ object()

QObject * QAxAggregated::object ( ) const
inlineprotected

Returns a pointer to the QObject subclass implementing the COM object.

This function might return 0.

Warning
You must not store the returned pointer, unless you use a QPointer, since the QObject can be destroyed by ActiveQt at any time.

Definition at line 75 of file qaxaggregated.h.

75 { return the_object; }
QObject * the_object
Definition: qaxaggregated.h:79

◆ queryInterface()

long QAxAggregated::queryInterface ( const QUuid iid,
void **  iface 
)
pure virtual

Reimplement this pure virtual function to support additional COM interfaces.

Set the value of iface to point to this object to support the interface iid. Note that you must cast the this pointer to the appropriate superclass.

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;
}

Return the standard COM results S_OK (interface is supported) or E_NOINTERFACE (requested interface is not supported).

Warning
Even though you must implement the IUnknown interface if you implement any COM interface you must not support the IUnknown interface in your queryInterface() implementation.

Referenced by QAxServerBase::InternalQueryInterface(), and QAxClientSite::QueryInterface().

◆ widget()

QWidget * QAxAggregated::widget ( ) const
inlineprotected

Returns a pointer to the QWidget subclass implementing the ActiveX control.

This function might return 0.

Warning
You must not store the returned pointer, unless you use a QPointer, since the QWidget can be destroyed by ActiveQt at any time.

Definition at line 71 of file qaxaggregated.h.

72  {
74  }
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObject * the_object
Definition: qaxaggregated.h:79

Friends and Related Functions

◆ QAxClientSite

friend class QAxClientSite
friend

Definition at line 61 of file qaxaggregated.h.

◆ QAxServerBase

friend class QAxServerBase
friend

Definition at line 60 of file qaxaggregated.h.

Properties

◆ controlling_unknown

IUnknown* QAxAggregated::controlling_unknown
private

◆ the_object

QObject* QAxAggregated::the_object
private

The documentation for this class was generated from the following files: