Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert QJsonArray string to QVariantList object

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

It is believed that many inexperienced people have no idea about how to convert QJsonArray strings into QVariantList objects. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

QVariantList is easy to use in Qt. If data transmission is involved, you need to convert QVariantList data into JsonArray strings. The conversion Qt has been implemented, and you only need to call the API to complete the conversion. The code is as follows:

Main.cpp

# include # include int main (int argc, char * argv []) {QCoreApplication a (argc, argv); QVariantList QVarList; QVariantMap tmpvm; for (int I = 0; I < 3; I + +) {tmpvm.clear (); tmpvm ["name"] = QString ("Test%1") .arg (I); tmpvm ["no"] = QString::number (I); QVarList

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report