EnginioReply value out of QObject scope is null



  • Hi,

    I'm trying to use Qt Cloud Services.. but with query I have one simple problem...
    When I'm trying to get reply data out of scope they're reseting to zero...

    code:
    @QJsonObject query;
    query["objectType"] = QString::fromUtf8("objects.chat");

    EnginioReply* reply = client->query(query);
    
    int serverMessIndex = 0;
    
    QObject::connect(reply, &EnginioReply::finished, [&](EnginioReply* reply)
    {
        if(!reply->isError())
            serverMessIndex = reply->data().count();
    
       qDebug() << serverMessIndex; // print ex. 2
    });
    
    qDebug() << serverMessIndex; // print 0@


  • On line 16 the (asynchronous) reply hasn't arrived yet.
    So it's not resetted, it's just set to 0 at line 6.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.