Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qlist structure Data
Forum Updated to NodeBB v4.3 + New Features

Qlist structure Data

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 486 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    satyanarayana143
    wrote on last edited by
    #1

    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.

    jsulmJ 1 Reply Last reply
    0
    • S satyanarayana143

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @satyanarayana143 You can use QDataStream for that. See https://doc.qt.io/qt-5/qtnetwork-fortuneclient-example.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved