In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how Qt exports xml. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
I. Preface
Can export control layout and property settings data to xml files or other files, it is also a very practical feature, similar to the QtDesigner page design generated after the end of the .ui file, in fact, is the xml file, in accordance with the agreed rules to store the control name and property name and the corresponding property values, and then open according to this rule to take out the line. Each control also has several fixed pieces of data to store, such as the XY axis and the corresponding width and height, and then the width and height of the entire canvas can be stored at the beginning of the xml data file for other purposes. Export to xml format is to facilitate parsing, after all, xml data format parsing, a variety of language platforms, and are very mature and fast. In fact, you can also consider storing it in the database, so it will be more powerful, you can store more things, and you can do more things.
Second, the functions realized
Automatically load all the controls in the plug-in file to generate a list, with more than 120 controls by default.
Drag to the canvas to automatically generate the corresponding control, WYSIWYG.
On the right side of the Chinese attribute bar, change the corresponding attributes immediately applied to the corresponding selected controls, intuitive and concise, very suitable for rookies to use.
The original attribute bar text translation mapping mechanism is extremely efficient, and it is very convenient to expand the attribute bar of other languages.
The properties of all controls are automatically extracted and displayed in the right property bar, including the enumerated value drop-down box.
Support manual selection of plug-in files, external import plug-in files.
You can export all control configuration information for the current canvas to a xml file.
You can manually select the xml file to open the control layout and automatically load the control according to the xml file.
Can pull the slider, check the analog data check box, text box input, three ways to generate data to apply all controls.
The control supports eight azimuth pull adjustments, adapts to any resolution, and fine-adjusts the position up and down the keyboard.
Through the serial port acquisition, network acquisition, database collection of three ways to set data.
The code is extremely concise, the comments are very detailed, and can be used as an embryonic form of configuration to expand more functions.
Pure Qt writing, support any Qt version + any compiler + any system.
Third, effect picture
4. Core code void frmMain::saveFile (const QString & fileName) {QFile file (fileName); if (! file.open (QFile::WriteOnly | QFile::Text | QFile::Truncate)) {return;} / / output file QTextStream stream (& file) in stream form; / / build xml data QStringList list; / / add fixed header data list
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.