Note that there are some explanatory texts on larger screens.

plurals
  1. POQDbus: Service Call Returning QList<int>
    primarykey
    data
    text
    <p>I'm running into difficulty retrieving values from a service call that is supposed to return an array of integers. The method call in the interface xml file is defined as:</p> <pre><code>&lt;method name="PurpleFindBuddies"&gt; &lt;annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&amp;lt;int&gt;"/&gt; &lt;arg name="accountId" type="i" direction="in" /&gt; &lt;arg name="screenName" type="s" direction="in" /&gt; &lt;arg name="buddies" type="ai" direction="out" /&gt; &lt;/method&gt; </code></pre> <p>qdbusxml2cpp generates the following method:</p> <pre><code> inline QDBusPendingReply&lt;QList&lt;int&gt; &gt; PurpleFindBuddies(int accountId, const QString &amp;screenName) { QList&lt;QVariant&gt; argumentList; argumentList &lt;&lt; QVariant::fromValue(accountId) &lt;&lt; QVariant::fromValue(screenName); return asyncCallWithArgumentList(QLatin1String("PurpleFindBuddies"), argumentList); } </code></pre> <p>I have also added </p> <pre><code>Q_DECLARE_METATYPE(QList&lt;int&gt;) </code></pre> <p>at the top of the generated .h file. And in main.cpp, I'm making the following call</p> <pre><code>QDBusPendingReply&lt;QList&lt;int&gt; &gt; buddies = pidgin-&gt;PurpleFindBuddies(accountId, "email@gmail.com"); buddies.waitForFinished(); if ( buddies.isError() ) { qDebug() &lt;&lt; buddies.error(); return -1; } qDebug() &lt;&lt; buddies.argumentAt(0).toList().size(); </code></pre> <p>When I launch the program, I can see from the enabled debug output that I am getting results, as shown below, but the qDebug() line prints 0. I cannot figure out how to correctly retrieve the results.</p> <pre><code>QDBusConnectionPrivate(0x138fbc0) got message reply (async): QDBusMessage(type=MethodReturn, service=":1.135", signature="ai", contents=([Argument: ai {859}]) ) </code></pre> <p>What am I missing? Any assistance would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload