I want to send QSqlQueryModel to the another client with QDatastream and QTcpSocket. I want to remove some rows and add few extra rows to QSqlQueryModel (without changing the database) and send it to the client like this pseudocode:-
QTcpSocket socket;
socket.setSocketDescriptor(handle);
socket.waitForReadyRead(WAIT_TIME);
QByteArray req = socket->readAll();
QDataStream reqstream(&req,QIODevice::ReadOnly);
QSqlQueryModel MyModel;
....
// fetch data with MyModel
// add/remove some rows from that model without adding/removing them from actual database
....
QByteArray res;
QDataStream resstream(&res,QIODevice::WriteOnly);
resstrem << MyModel;
socket.write(res);
How can I achieve this without creating new deep copy of Model. On the client side, it should only receive a model with data so I can show it in QML.