Unsolved Qlist structure Data
-
Hi friends,
I have structure Like this as Given below and Qlist with structure 0bject like this QList<ChannelInfo> m_nChannelInfoList;struct ChannelInfo
{
QString channelType;
QString groupids;
int inputport;
int outputport;
QString InputIp;
QString OutputIp;
int channelDownbw;
int channelUpbw;
};and filling data to structure and append structure to that list as below now i want to append structure whole data via tcp socket to client how i have to send.
m_nChannelInfoList size is 2
for(int i = 0;i<m_nChannelIDList.size();i++)
{QString channelsInfoOutput = channelInfoReply->readAll(); QJsonDocument jsonResponse = QJsonDocument::fromJson(channelsInfoOutput.toUtf8()); QJsonObject jsonObject = jsonResponse.object(); ChannelInfo m_nChannelInfo; m_nChannelInfo.channelType = jsonResponse.object().value("channel_type").toString(); m_nChannelInfo.InputIp = jsonResponse.object().value("input_ip").toString(); m_nChannelInfo.OutputIp = jsonResponse.object().value("output_ip").toString(); m_nChannelInfo.groupids = jsonResponse.object().value("groupids").toString(); m_nChannelInfo.outputport = jsonResponse.object().value("output_port").toInt(); m_nChannelInfo.channelDownbw = jsonResponse.object().value("channel_down_bw").toInt(); m_nChannelInfo.channelUpbw = jsonResponse.object().value("channel_up_bw").toInt(); m_nChannelInfoList.append(m_nChannelInfo); }
now i want whole data of list structure should be sent to tcp client.what is the method to do.
-
@satyanarayana143 You can use QDataStream for that. See https://doc.qt.io/qt-5/qtnetwork-fortuneclient-example.html