Answer the question
In order to leave comments, you need to log in
Why is the signal not connected to the slot?
There is a method:
QNetworkReply* QVkApi::request(QString method, QVariantMap args)
{
QString req ="https://api.vk.com/method/";
req+=method+"?";
for(auto arg = args.begin(); arg != args.end();arg++){
req += "&"+arg.key()+"="+arg.value().toString();
}
req += "&access_token=" + token + "&v=5.53";
QNetworkRequest reques(req);
QNetworkReply* reply = _accessManager->get(reques);
connect(reply, &QNetworkReply::finished,this, &QVkApi::onReply);
return reply;
}
User::User(int id, QObject *parent) : AbstractEntity(id,parent)
{
QVariantMap args;
args["fields"] = "photo_50,city,verified";
args["name_case"] = "Nom";
reply = api->request("users.get", args);
connect(reply, &QNetworkReply::finished, this, &User::onUpdate);
}
#ifndef USER_H
#define USER_H
#include "abstractentity.h"
class User : public AbstractEntity
{
Q_OBJECT
public:
explicit User(int id, QObject *parent = 0);
signals:
public slots:
void onUpdate();
};
#endif // USER_H
#ifndef ABSTRACTENTITY_H
#define ABSTRACTENTITY_H
#include <QObject>
#include <QNetworkReply>
#include "qvkapi.h"
class AbstractEntity : public QObject
{
public:
explicit AbstractEntity(int id, QObject *parent = 0);
int id;
QNetworkReply* reply;
protected:
QVkApi* api;
};
#endif // ABSTRACTENTITY_H
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question