[Interest] Support for multiple 'out' parameters in qdbusxml2cpp

Thiago Macieira thiago.macieira at intel.com
Sat Jul 27 00:45:01 CEST 2013


On sexta-feira, 26 de julho de 2013 16:35:24, Matt Hoosier wrote:
> Okay, I agree that I could pin down the parent class name and get automatic
> dispatch wired up. But I'd like to understand why the normal
> QMetaObject::invokeMethod() dispatch isn't allowed in this case (that is,
> more than one 'out' parameter). 

Because invokeMethod cannot pass non-const references. That's a limitation of 
QMetaObject::invokeMethod.

Or, at least, it was a limitation when this code was written back in Qt 4.2 
days. Looking at the Q_ARG macro and its classes today, looks like I fixed it 
for Qt 4.7:
  http://gitorious.org/qt/qt/commit/67cd8cc97104e38f2e3bae03b2a4c3575c73c461
  https://bugreports.qt-project.org/browse/QTBUG-8592

It appears to be testing this particular code:
    // make the INVOKABLE call without a return type
    QDBusVariant arg3("hello"), arg4("world");
    QVERIFY(QMetaObject::invokeMethod(&iface, "ping_invokable",
                                      Q_RETURN_ARG(QDBusVariant, retArg),
                                      Q_ARG(QDBusVariant, arg3),
                                      Q_ARG(QDBusVariant, arg4),
                                      Q_ARG(QDBusVariant&, retArg2)));

Which is exactly your case. So apparently it is now supported, but I've never 
got around to updating the generator, especially because all serious users of 
the generator pass the -l parameter.

> The test up top there forbids the generated code from ever using
> QMetaObject::invokeMethod() if there's more than one output argument for
> the D-Bus method. Why's that? The MOC doesn't generally have any trouble
> plumbing up calls using arbitrarily many arguments, including non-const ref
> types that would be used to pass down "out" parameters.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130726/10d07084/attachment.sig>


More information about the Interest mailing list