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

What is the method of exporting Qt data

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces "what is the method of exporting Qt data". In the daily operation, I believe that many people have doubts about the method of exporting Qt data. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "what is the method of Qt data export?" Next, please follow the editor to study!

I. Preface

Data export is generally directed to excel tables, and some users may also need to export to pdf, because pdf is basically uneditable to prevent users from re-editing the exported data. Excel may be known by most people who have used computers. It is widely popular, mainly Microsoft's office software and Kingsoft's wps software, so when it comes to exporting data, basically the default is to export to excel. So that leaders or other non-software professionals can open it to see the data, or analyze the data twice. There is no data exported to excel-related classes in Qt, and there are some third-party open source such as qtxlsx, libxls, etc., many beginners first choose to use qaxobject to call excel components to export data, this method is relatively primitive, but also powerful, as long as it is provided by the excel interface, it can be implemented, such as exporting specific graphics, etc. The disadvantage is that it is slow, the speed is really slow, hundreds of millions of data are exported, and the efficiency is relatively low. To put it bluntly, the key is not cross-platform, but only on WIN, when all other systems stop, while a large number of Qt application scenarios are in the linux system, which is also the place where Qt's start-up families get rich. Qtxlsx and libxls solve this problem very well, cross-platform.

Features of the general data export component:

Original data export mechanism, does not rely on any office components or operating systems and other third-party libraries, especially support embedded linux.

The nine fields of 100000 rows of data only take 2 seconds to complete.

It only takes four steps to start rapidly exporting large amounts of data to Excel.

At the same time, it provides direct write data interface and multi-thread write data interface without card main interface.

The title, subtitle and table name can be set.

Field name and column width can be set.

You can set whether to enable check filter data, check columns, check rules, check values, and special color display that meets the rules.

You can set a random background color and a collection of columns that require a random background color.

Support grouping output data, such as according to the device grouping output data, easy to view.

The line content separator can be customized.

Data can be written in the form of additional data. It is recommended that the number of additional data at a time is less than 10000.

High flexibility, free to change the source code setting alignment, text color, background color and so on.

Support any excel spreadsheet software, including but not limited to excel2003/2007/2010/2013/2017/wps/openoffice.

In addition to providing classes for exporting to Excel, there are also classes for exporting to Pdf files and printing data.

Complete annotations, detailed and complete use of demo, support for QTableWidget, QTableView, database three data sources.

Pure Qt writing, support any Qt version + any compiler + any system.

II. Functional features

Collect data port, support serial port + network port, serial port support free setting of serial number + baud rate, network support free setting of IP address + communication port, each port supports collection cycle, default one address per second, support setting communication timeout times, default 3 times, support maximum reconnection time, used to re-read offline devices.

Controller information, you can add the controller name, select the controller address + controller model, and set the number of detectors under the controller.

Detector information, can add tag, free to choose detector type, gas type, gas symbol, high reported value, low reported value, buffer value, clear zero value, whether enabled, alarm sound, background map, storage cycle, numerical conversion decimal places, alarm delay time, alarm type (HH,LL,HL) and so on.

Controller model + detector type + gas type + gas symbol, all can be configured freely.

Maps can be imported and deleted, and all detectors can be dragged and saved freely.

Port information + controller information + detector information, support import and export + export to excel+ printing.

Run record + alarm record + user record, support multi-condition combination query, such as time period + controller + detector, etc., all records can be exported to excel+ printing.

Records exported to excel support all versions of table files such as excel+wps and do not rely on software such as excel.

You can delete data within a specified time range, support automatic cleaning of early data, and set the maximum number of saved records.

Support alarm short message forwarding, support multiple receiving mobile phone numbers, you can set the sending interval, such as instant sending or sending all alarm messages once every 6 hours, the text message content is too long, automatically split multiple text messages.

Support alarm email forwarding, support multiple receiving mailboxes, can set sending interval, such as immediate sending or sending all alarm messages once every 6 hours, support attachment sending.

Overreport color + underreport color + normal color + 0 value color + curve background + curve color, etc., are free to choose.

The Chinese title + English title + logo path + copyright of the software can be set freely.

Provide switch settings for boot operation + alarm sound + automatic login + remember password and so on.

Alarm sound can be set to play the number of times, the interface provides 17 kinds of skin file selection.

Cloud data synchronization is supported, and the information of cloud database can be set, such as database name, user name + password, etc.

Support network forwarding and network reception, after the network reception is turned on, the software receives data from udp for analysis. Network forwarding supports multiple target IP, so it realizes the software of local collection, and freely transfers the data to the client to view the detector data at any time.

Automatically remember the user's last stay in the interface + other information, restart and apply automatically.

The alarm automatically switches to the corresponding map, and the detector button flashes.

Double-click the detector icon to control it back.

Support user rights management, administrator + operator two categories, user login + user exit, can remember the password and automatic login, more than three error messages and close the program.

Support four monitoring modes, equipment panel monitoring + map monitoring + table data monitoring + curve data monitoring, free to switch, four synchronous applications.

Support alarm relay linkage, a tag can link multiple modules and relay numbers across serial ports, and support many-to-many.

The local data store supports sqlite+mysql and remote data synchronization to the cloud database. Automatically reconnect.

The data collected by the local device is uploaded to the cloud in real time so that it can be extracted by other methods such as APP or web.

Two kinds of data sources are supported, one is serial port and network to collect equipment data through protocol, the other is database collection. The database acquisition mode can be used as a general system.

Comes with a device simulation tool that supports 16 device data simulations, as well as database data simulations to test data when there is no device.

The default communication protocol uses modbus protocol, and later increases the support of mqtt and other Internet of things protocols to make a general system.

Supports all windows operating systems + linux operating systems and other operating systems.

Third, effect picture

4. The core code void frmDataAlarm::on_btnExcel_clicked () {/ / determines the number of rows first. If it exceeds a certain size, the pop-up prompt QString str = ui- > labResultCount- > text (); QStringList list = str.split ("); int rowCount = list.at (1). ToInt (); if (rowCount > 100000) {QUIHelper::showMessageBoxError (" do not support a large amount of data, please query again! ", 3); return } if (rowCount > 10000) {QString msg = QString ("there are 1 pieces of data to be exported, please be patient! Are you sure you want to export data? ") .arg (rowCount); if (QUIHelper::showMessageBoxQuestion (msg)! = QMessageBox::Yes) {return;}} QString fileName = API::getFileName (" Save File (* .xls) ", QUIHelper::appPath () +" / db ", QString (" alarmlog_%1.xls ") .arg (STRDATETIME)); if (fileName.isEmpty ()) {return } / / set export data field and sort field QString columns = "LogID,PositionID,DeviceName,NodeName,NodeValue,NodeSign,Content,StartTime,ConfirmUser,ConfirmTime,ConfirmContent"; QString where = whereSql + "order by" + QString ("LogID% 1") .arg (App::AlarmLogOrder); QStringList content = DBHelper::getContent ("AlarmLog", columns, where, "", ";"); QList columnNames; QList columnWidths; columnNames

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