QDbus: Service Call Returning QList<int>
-
I posted "this question":http://stackoverflow.com/questions/11166352/qdbus-service-call-returning-qlistint on stackoverflow, which I'm linking to in case anyone wants to provide the answer there.
Basically, I'm trying to retrieve a list of accounts using Pidgin's DBUS interface. I created the interface.xml and ran that through the qdbusxml2cpp to generate the appropriate classes. The service call to retrieve a list of buddies has a return type of ai, which I believe should be translated to QList<int>. While I can see I am retrieving the appropriate data through the use of the debug mode, I cannot seem to get the results to convert from the QVariant to the QList<int> ( see the stackoverflow question for full code details ).
If someone could please help point me in the right direction, I would definitely appreciate it! Thanks so much.
-
I figured this problem out. I posted the answer on SO, but wanted to include it here as well.
So apparently everything was configured correctly. However, when trying to retrieve the data, instead of doing:
@qDebug() << buddies.argumentAt(0).toList().size();@
I should have been doing:
@qDebug() << QString::number(buddies.value().size());@
To retrieve the individual ids
@foreach(int id, buddies.value() )
qDebug() << QString::number(id);
// or simply
QList<int> ids = buddies.value();@