One, foreword

Graphic report corresponding text report before, after the previous log query, need to print or export, is a line of written records, the recent need graphic printing and exporting industry record, so thoroughly before advantage when data import and export (XLS/PDF) and reinvent rewrite print components, before this is also the legacy of a framework needs to be components, Deleted 60% of the redundant code, increased the structure of the storage export print data parameters, made a general static function export and print, very convenient, but also expanded the graph and text warning data export print support, support to pass the picture path, customize the main title subtitle and so on. In the whole process of transformation, summed up a few small experience.

  • If a function returns a value, it must actively return a value. Some compilers can compile without a value, but will fail to get the desired result when running, because there is no corresponding value for return.
  • It’s a good habit to get into, because otherwise the compiler might not give you the initial value you want. For example, an int variable defaults to 0, sometimes it randomly changes to a very large value, bool variables start with different values, some are true, some are false, It is more reliable to give an initial value voluntarily.
  • Late some function arguments a lot, and may also be modified and increased, resulting in the source after modification, the correlation signal channel place also to be modified, parameter type and location must be kept completely consistent, the corresponding slot function to modify and so on, also changes the workload is very big and very friendly, so for the function of fixed parameters, the suggested structure, This is very easy to add other parameters, and there is no need to modify the signal slot association and signal slot function definition, such as student information table, commodity information table as parameter transmission, the best solution is the structure.

Graphic report function features

  1. Original export data mechanism, does not rely on any Office components or third-party libraries such as operating systems, especially support embedded Linux.
  2. It only takes 2 seconds to complete 100,000 rows of data and 9 fields.
  3. It only takes four steps to start rapping out large amounts of data to Excel.
  4. At the same time provide direct write data interface and multithreading write data interface, not card main interface.
  5. You can set the title, subtitle, and table name.
  6. You can set the field name and column width.
  7. You can set whether to enable verification filtering data, verification columns, verification rules, and verification values, and display them in special colors that match the rules.
  8. You can set a random background color and a collection of columns that require a random background color.
  9. You can output data in groups, for example, by device, for easy viewing.
  10. Customizable row content delimiters.
  11. Data can be appended. You are advised to add less than 10000 pieces of data each time.
  12. Super flexibility, you can freely change source alignment, text color, background color, etc.
  13. Support arbitrary excel spreadsheet software, including but not limited to excel2003/2007/2010/2013/2017 / WPS/openoffice, etc.
  14. In addition to providing classes for exporting to Excel, there are also classes for exporting to Pdf files and printing data.
  15. Complete annotation, detailed and complete use of demo, support QTableWidget, QTableView, database three data sources.
  16. Pure Qt preparation, support any Qt version + any compiler + any system.

Two, functional characteristics

(1) Software module

  1. Video monitoring module, various docking small window sub-module, including device list, graphic warning, window information, panyt control, preset position, cruise setting, device control, floating map, web browsing, etc.
  2. Video playback module, including local playback, remote playback, device playback, picture playback, video upload, etc.
  3. Electronic map module, including picture map, online map, offline map, path planning, etc.
  4. Log query module, including local logs, device logs, etc.
  5. System setting module, including system Settings (basic Settings, video parameters, database Settings, map configuration, serial port configuration, etc.), VIDEO recorder management, camera management, polling configuration, user management, etc.

(2) Basic functions

  1. Support various video streams (RTSP, RTMP, HTTP, etc.), video files (MP4, RMVB, AVI, etc.), local USB camera playback.
  2. Support multi-screen switching, including 1, 4, 6, 8, 9, 13, 16, 25, 36, 64 screen switching.
  3. Supports full-screen switching, including the right mouse button, toolbar button, and shortcut keys (Alt + Enter full-screen, esc exit full-screen).
  4. Supports video polling, including 1, 4, 9, and 16 screen polling. You can set polling group (polling plan), polling interval, and bit stream type.
  5. Supports the OnVIF protocol, including device search, pte control, device control (picture parameters, check time, system restart, capture pictures, etc.).
  6. Different users can have different module permissions, such as deleting logs and shutting down the system.
  7. Support a variety of databases, including sqlite, mysql, sqlserver, postgresql, oracle, rendajincang and so on.
  8. You can set resolution and frame rate for a local USB camera.
  9. All docking modules automatically generate corresponding menus to control the display and hide, in the title bar right click can pop up.
  10. Display all modules, hide all modules, reset the common layout, and reset the full-screen layout.
  11. Double-click the device to pop up real-time preview video, supporting picture map, online map, offline map, etc.
  12. The camera node can be dragged to the corresponding window to play the video, and the local file can be dragged to play the video.
  13. You can delete a video by right-clicking the mouse button, closing the floating bar, or dragging it outside the video surveillance panel.
  14. The device button on the picture map can be dragged freely to automatically save the location information. You can click the mouse to obtain the longitude and latitude information on the Baidu map to update the location of the device.
  15. Any channel in the video surveillance panel form supports drag exchange, instant response.
  16. Encapsulated Baidu map, view switch, movement track, equipment point, mouse click to obtain latitude and longitude.
  17. Double-click the node, drag the node, drag the window to switch positions and other operations, will automatically update and save the last playing address, the next software open automatic application.
  18. Volume bar control in the lower right corner, automatically hide when losing focus, volume strip mute icon.
  19. You can specify a screenshot for a single channel or all channels. The screenshot button is also available on the bottom toolbar.
  20. The mouse pointer can be automatically hidden when timeout expires and the mouse pointer can be automatically displayed in full screen.
  21. Support onVIF PTZ control, can move PTZ camera up, down, left and right, including reset and focal length adjustment.
  22. Support any ONVIF camera, including but not limited to Hikang, Dahua, Yushi, Weiye, Huawei, etc.
  23. Can save video, can select the time storage or single file storage, optional storage interval time.
  24. Video stream communication mode can be set TCP + UDP, video decoding can be set speed first, quality first, balance, etc.
  25. You can set the software name, English name, and LOGO icon.
  26. You can export stored video files to specific directories or upload them to servers in batches.

(3) Features and functions

  1. The main interface adopts the mode of docked form, various components in the form of small modules, can be customized to join any module.
  2. Docking module can drag any position embedded and suspended, support maximum full screen, support multi-screen.
  3. Dual layout file storage mechanism, normal mode and full-screen mode are corresponding to different layout schemes, automatic switching and saving, for example, full-screen mode can highlight several modules transparent display in the specified position, more science fiction sense of modernization.
  4. Original onVIF protocol mechanism, using the underlying protocol resolution (UDP broadcast search + HTTP request execution command) more lightweight easy to understand learning expansion, does not rely on any third-party components such as GSOAP.
  5. Original data import and export mechanism, cross-platform independent of any components, instant data export.
  6. Built in multiple original components, the universe super value super awesome, Including data import and export components (export to XLS, PDF, printing), database components (database management thread, automatic data cleaning thread, universal paging, data request, etc.), map component, video monitoring component, file multithreading transceiver component, onVIF communication component, universal browser kernel component, etc.
  7. Customize information box + error box + query box + lower right prompt box (including various formats).
  8. Exquisite skin change, up to 17 sets of skin styles can be changed at will, all styles are unified, including menu, etc.
  9. Multiple buttons can be added to the video control hover bar, and buttons can also be added to the small toolbar at the bottom of the monitoring interface.
  10. Double click the camera node to automatically play the video, double click the node to automatically add the video, it will automatically jump to the next, double click the parent node to automatically add all the videos under the node. Primary stream and sub-stream are optional.
  11. You can add, delete, and modify the import and export printed information, and immediately apply the new device information to generate a tree list without restarting.
  12. Optional a variety of kernel free switch, FFMPEG, VLC, MPV, etc., can be set in pro. Ffmpeg is recommended. It is most cross-platform and provides libraries compiled on Linux and MAC platforms by default.
  13. Supports hard decoding and can be set to hard decoding type (QSV, DXVA2, d3D11VA, etc.).
  14. The default opengL rendering video, ultra-low CPU resource consumption, support YUYV and NV12 two formats to draw, very awesome.
  15. Highly customizable, users can easily derive their own functions on this basis, such as adding custom modules, adding operation mode, robot monitoring, uav monitoring, excavator monitoring, etc.
  16. Support XP, Win7, Win10, Linux, MAC, a variety of domestic systems (UOS, kyrin, Galaxy Kyrin, etc.), embedded Linux and other systems.
  17. Complete annotation, clear project structure, super detailed complete use of the development manual, accurate to the function description of each code file, continuous iteration version.

3. Experience address

  1. Experience address: pan.baidu.com/s/1d7TH_GEY… Extraction code: 01Jf File name: bin_video_system.zip
  2. Domestic site: gitee.com/feiyangqing…
  3. International site: github.com/feiyangqing…
  4. Profile: blog.csdn.net/feiyangqing…
  5. Zhihu homepage: www.zhihu.com/people/feiy…
  6. Online documentation: feiyangqingyun. Gitee. IO/qwidgetdemo…

Four, effect drawing

Five, core code

#include "datacreat.h"

void DataCreat::creatUavsReportHead(QStringList &list, const UavsReportData &reportData)
{
    // start the tableList << "<table border='0.0' cellpadding='6'>"; // list <<"<tr>"; list << QString("<td width='100%' align='center' style='font-size:22px; font-weight:bold; ' colspan='% 1'> %2</td>").arg(2).arg(reportData.title); list << "</tr>"; // list <<"<hr>"; //list << "<br>"; QString style ="style='font-size:18px; '"; QString name = QString("Device name: %1").arg(reportData.name); list << "<tr>"; list << QString("<td colspan='% 1' %2> %3</td>").arg(2).arg(style).arg(name); list << "</tr>"; // QString LNG = QString("Equipment longitude: %1").arg(reportData.lng); QString lat = QString("Device latitude: %1").arg(reportData.lat); list << "<tr>"; list << QString("<td %1> %2</td>").arg(style).arg(lng); list << QString("<td %1> %2</td>").arg(style).arg(lat); list << "</tr>"; QString timeAlarm = QString("Alarm date: %1").arg(reportData.timeAlarm); QString timeReport = QString("Report time: %1").arg(reportData.timeReport); list << "<tr>"; list << QString("<td %1> %2</td>").arg(style).arg(timeAlarm); list << QString("<td %1> %2</td>").arg(style).arg(timeReport); list << "</tr>"; List <<"</table>"; } void DataCreat::creatUavsReportBody(QStringList &list, const UavsReportData &reportData, Int imageWidth) {// list <<"<br><br>"; // start list <<"<table border='0.5' cellspacing='0' cellpadding='5'>"; // list <<"<tr>"; list << QString("<td width='100%' align='center' style='font-size:20px; font-weight:bold; ' colspan='% 1'> %2</td>").arg(2).arg(reportData.subTitle); list << "</tr>"; QString style ="style='font-size:18px; '"; QString Type = QString("Alarm type: %1").arg(reportData.type); list << "<tr>"; list << QString("<td width='100%' colspan='% 1' %2> %3</td>").arg(2).arg(style).arg(type); list << "</tr>"; QString textCount = QString("Target number: %1").arg(reportData.textCount); QString textLevel = QString("Threat level: %1").arg(reportData.textLevel); list << "<tr>"; list << QString("<td %1> %2</td>").arg(style).arg(textCount); list << QString("<td %1> %2</td>").arg(style).arg(textLevel); list << "</tr>"; QStringList listImage = reportData.images; int count = listImage.count(); QString text = QString("Alarm images (total %1Zhang)").arg(count); list << "<tr>"; list << QString("<td width='100%' align='center' style='font-size:20px; font-weight:bold; ' colspan='% 1'> %2</td>").arg(2).arg(text); list << "</tr>"; QString path = qApp->applicationDirPath() +"/snap/"; for (int i = 0; i < count; ++i) { QImage image(listImage.at(i)); if (image.width() > imageWidth) { QString name = path + QString("%1.jpg").arg(i + 1); image = image.scaled(imageWidth, image.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); image.save(name, "jpg"); listImage[i] = name; } } //qDebug() << listImage; Style = "box-sizing: border-box! Important;style='vertical-align:middle; '"; for (int i = 0; i < count; i = i + 2) { list << "<tr>"; list << QString("<td align='center' %1><img src='% 2'></td>").arg(style).arg(listImage.at(i)); If (I < count - 1) {list << QString("<td align='center' %1><img src='% 2'></td>").arg(style).arg(listImage.at(i + 1)); } list << "</tr>"; } // table end list <<"</table>";
}
Copy the code