Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDbus: Service Call Returning QList<int>
QtWS25 Last Chance

QDbus: Service Call Returning QList<int>

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    keelerm84
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      keelerm84
      wrote on last edited by
      #2

      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();@

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved