Best way to pass data from backend c++
Solved
QML and Qt Quick
-
Hi, I need to link the data from the classes connected to the backend, for example I have this class where it receives the data from the server through this method:
void ClientServices::readyRead() { QDataStream in(tcpSocket);//QtcpSocket int code = 0; double pCost = 0; double pPublic = 0; in >> code >> pCost >> pPublic; qDebug() << code << pCost << pPublic; }
the Backend is declare in this mode:
qmlRegisterType<Backend>("io.qt.Backend", 1, 0, "Backend");
can I do?
I think to do with the Q_Property but but I wouldn't go for the backend anymore. In practice I have to fill in text boxes with variable :
code >> pCost >> pPublic;
-
@Tom_H said in Best way to pass data from backend c++:
@Nio74 use
Q_PROPERTY
for code, pCost, and pPublicbut I scould declared more classes in te main?
If Yes can I used the same template?qmlRegisterType<Backend>("io.qt.Backend", 1, 0, "Backend"); qmlRegisterType<ClientServices>("io.qt.Backend", 1, 0, "Clientservice");