You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

41 lines
972 B

#include "bridge.h"
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <QDebug>
#include <QTimer>
Bridge::Bridge(QObject *parent)
: QObject{parent}
{
QJsonDocument jsonDoc;
QJsonArray mainArray;
QJsonObject obj1;
obj1.insert ("source","source1");
obj1.insert ("destination","destination1");
obj1.insert ("message","message1");
obj1.insert ("duration","duration1");
QJsonArray childArray;
childArray.append (obj1);
childArray.append (obj1);
obj1.insert ("child",childArray);
mainArray.append (obj1);
mainArray.append (obj1);
jsonDoc.setArray (mainArray);
QString jsonString = jsonDoc.toJson();
connect (this,&Bridge::sortsChanged ,[=](int path,int path1,int path2,
int path3){
qDebug() << "___________--";
qDebug() << path << " " << path1;
});
QTimer::singleShot(2000, this, [=](){
emit setJsonData (jsonString);
});
}