이 페이지에서

QAxAggregated Class

QAxAggregated 클래스는 추가적인 COM 인터페이스를 구현하기 위한 추상 기본 클래스입니다. 더 보기...

헤더: #include <qaxaggregated.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS AxServer)
target_link_libraries(mytarget PRIVATE Qt6::AxServer)
qmake: QT += axserver

공개 함수

virtual long queryInterface(const QUuid &iid, void **iface) = 0

보호된 함수

QAxAggregated()
virtual ~QAxAggregated()
IUnknown *controllingUnknown() const
QObject *object() const
QWidget *widget() const

상세 설명

QAxAggregated의 하위 클래스를 생성하고, 추가적인 COM 인터페이스를 지원하기 위해 queryInterface()을 재구현하십시오. 해당 COM 인터페이스들로부터 다중 상속을 사용하십시오. QueryInterface(), AddRef() 및 Release() 에 대한 호출을 controllingUnknown()이 제공하는 인터페이스로 위임하여, 해당 COM 인터페이스들의 IUnknown 인터페이스를 구현하십시오.

ActiveX 컨트롤을 구현하는 QWidget 에 호출을 수행해야 하는 경우 widget() 메서드를 사용하십시오. QWidget 는 ActiveQt 프레임워크에 의해 언제든지 소멸될 수 있으므로, QPointer 를 사용하는 경우가 아니라면 해당 포인터를 서브클래스에 저장해서는 안 됩니다.

QAxBindable, QAxFactory 및 Active Qt.

멤버 함수 문서

[constexpr noexcept protected default] QAxAggregated::QAxAggregated()

QAxAggregated 의 인스턴스를 기본 생성합니다.

[virtual constexpr noexcept protected default] QAxAggregated::~QAxAggregated()

소멸자는 Qt에 의해 내부적으로 호출됩니다.

[protected] IUnknown *QAxAggregated::controllingUnknown() const

ActiveX 컨트롤의 ` IUnknown ` 인터페이스를 반환합니다. ` QAxAggregated ` 하위 클래스에서 ` IUnknown ` 인터페이스를 구현하여 ` QueryInterface()`, ` AddRef()` 및 ` Release() `에 대한 호출을 이 함수가 제공하는 인터페이스로 위임하십시오.

HRESULT AxImpl::QueryInterface(REFIID iid, void **iface)
{
    return controllingUnknown()->QueryInterface(iid, iface);
}

ulong AxImpl::AddRef()
{
    return controllingUnknown()->AddRef();
}

ulong AxImpl::Release()
{
    return controllingUnknown()->Release();
}

이 세 가지 함수를 수동으로 선언하고 구현하는 대신, 서브클래스의 클래스 선언에서 ` QAXAGG_IUNKNOWN ` 매크로를 사용할 수 있습니다.

[protected] QObject *QAxAggregated::object() const

COM 개체를 구현하는 ` QObject ` 하위 클래스에 대한 포인터를 반환합니다. 이 함수는 0을 반환할 수도 있습니다.

경고: QObject 는 ActiveQt에 의해 언제든지 소멸될 수 있으므로, QPointer 를 사용하는 경우가 아니라면 반환된 포인터를 저장해서는 안됩니다 .

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

추가적인 COM 인터페이스를 지원하려면 이 순수 가상 함수를 재구현하십시오. iid 인터페이스를 지원하려면 iface 의 값을 이 객체를 가리키도록 설정하십시오. 이때 this 포인터를 적절한 슈퍼클래스로 형변환해야 한다는 점에 유의하십시오.

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

표준 COM 결과인 S_OK (인터페이스가 지원됨) 또는 E_NOINTERFACE (요청된 인터페이스가 지원되지 않음)을 반환하십시오.

경고: COM 인터페이스를 구현하는 경우 IUnknown 인터페이스를 반드시 구현해야하지만 , queryInterface() 구현에서는 IUnknown 인터페이스를 지원해서는 안 됩니다.

[protected] QWidget *QAxAggregated::widget() const

ActiveX 컨트롤을 구현하는 QWidget 하위 클래스에 대한 포인터를 반환합니다. 이 함수는 0을 반환할 수도 있습니다.

경고: QWidget 는 ActiveQt에 의해 언제든지 소멸될 수 있으므로, QPointer 를 사용하는 경우가 아니라면 반환된 포인터를 저장해서는 안됩니다 .

© 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.