QAxAggregated Class

QAxAggregated 클래스는 추가 COM 인터페이스의 구현을 위한 추상 베이스 클래스입니다. 더 보기...

Header: #include <QAxAggregated>
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

보호된 함수

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

자세한 설명

추가 COM 인터페이스를 지원하도록 queryInterface()의 서브클래스를 생성하고 다시 구현합니다. 해당 COM 인터페이스에서 다중 상속을 사용합니다. QueryInterface() , AddRef()Release() 에 대한 호출을 controllingUnknown()에서 제공하는 인터페이스에 위임하여 해당 COM 인터페이스의 IUnknown 인터페이스를 구현합니다.

ActiveX 컨트롤을 구현하는 QWidget 으로 호출해야 하는 경우 widget() 메서드를 사용합니다. QWidget 은 언제든지 ActiveQt 프레임워크에 의해 파괴될 수 있으므로 QPointer 을 사용하지 않는 한 해당 포인터를 서브클래스에 저장해서는 안 됩니다.

QAxBindable, QAxFactory, 및 Active Qt.

멤버 함수 문서

[virtual constexpr noexcept protected] 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 을 사용하지 않는 한 반환된 포인터를 저장해서는 안 됩니다.

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