使用 IDispatch* 类型的参数连接 QAxObject 事件

Connecting QAxObject event with a parameter of type IDispatch*

我正在尝试使用 ActiveQt 库来处理具有 IDispatch* 类型参数的 ActiveX 事件,例如 idl 文件中的以下内容。

// ...
library RecognitionClientLib
{
    importlib("stdole2.tlb");
    [
        uuid(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX),
        helpstring("_IIFactoryEvents Interface")
    ]
    dispinterface _IIRecognizerFactoryEvents
    {
        properties:
        methods:
            [id(1), helpstring("method OnError")] void OnError(
                [in] LONG ilOperationCode,
                [in] BSTR iszDescription
                );
            [id(2), helpstring("method OnResult")] void OnResult(
                [in] IDispatch* ilpSource,
                [in] LONG ilOperationCode
                );
    };
    [
        uuid(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX),
        control,
        helpstring("IFactory Class")
    ]
// ...

我使用了dumpcpp.exe并为该对象生成了一个头文件和一个cpp文件。 生成的文件跳过事件生成如头文件所示:

// skipping event interface _IIFactoryEvents

根据文档,IDispatch* 参数应转换为 "QAxBase::asVariant()"。因此,我尝试将事件连接如下:

ClientLib::IFactory* lpFactory(new ClientLib::IFactory());
bool lbOk(connect(
    lpFactory,
    SIGNAL(OnError(
        int,
        const QString&
        )),
    SLOT(onError(
            int,
            const QString&
        ))
    ));
assert(lbOk);
lbOk = connect(
    lpFactory,
    SIGNAL(OnResult(
        QVariant,
        int
        )),
    SLOT(onResult(
        QVariant,
        int
        ))
    );
assert(lbOk);

我连接 OnError 的信号没有问题,但是 OnResult 的连接失败

Object::connect: No such signal ClientLib::IFactory::OnResult(QAxObject*,int)

请帮我看看我应该为 IDispatch* 类型的参数使用什么参数类型?

非常感谢!

Please help me out on what parameter type should I use for an argument of IDispatch* type?

IDispatch* 映射到 QAxObject*http://doc.qt.io/qt-5/qaxbase.html

我发现参数类型应该是 IDispatch* 没有修改,尽管文档说它是 QAxBase::asVariant()对于类型为 IDispatch*.

的参数