A data display and save code automatic generation tool

By using a data display and code generation tool to automatically generate and save code, the problem of time-consuming and labor-intensive manual code writing in large-scale UAV ground station system projects has been solved. This tool enables highly efficient and automated code generation and database operations, improving development efficiency and software quality.

CN122431646APending Publication Date: 2026-07-21CHINESE AERONAUTICAL RADIO ELECTRONICS RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINESE AERONAUTICAL RADIO ELECTRONICS RES INST
Filing Date
2026-04-02
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In the development of large-scale UAV ground station systems, manually writing business object classes, interface operations, and database operations consumes a lot of time and effort, carries the risk of errors, and leads to low development efficiency and high costs.

Method used

The system employs an automatic code generation tool for data display and saving, implemented using QT. It includes modules for business object model management, object-relational mapping framework, and database management. It automatically generates entity class and form class code and automatically completes database operations through the DBEngine class.

Benefits of technology

It reduces the workload of developers, improves development efficiency, reduces the error rate of manually written code, improves software quality, and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122431646A_ABST
    Figure CN122431646A_ABST
Patent Text Reader

Abstract

The application discloses a kind of data display and save code automatic generation tool, is realized by qt, including business object model management, object relationship mapping framework, code generation and database management, business object model management module is used to define metadata, and after metadata definition is complete, model file is generated;Code generation module calls built-in template to generate code after model file generation, including entity class code, new form class code and editing form class code;Object relationship mapping framework provides database operation class DBEngine, is placed in new form class code and editing form class code generated by code generation module;Database management module stores the code into database form.The application reduces the workload of developer to write business object, improves development efficiency, reduces the error of manually writing this part of code, improves software quality, reduces cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software development, and in particular to an automatic code generation tool for displaying and saving data. Background Technology

[0002] Due to the rapid development of drones, ground stations are currently evolving towards a multi-drone model, meaning a single ground station system can control multiple, or even different, drones. A typical ground station primarily performs functions such as aircraft control, mission control, payload operation, payload data analysis, and system maintenance. For such large-scale projects, the business objects involved are diverse, requiring the creation and saving of numerous interface operations for these objects. These business objects contain attributes of various data types, each with a different value range. In traditional software development, the classes for each business object are manually written, UI elements are manually dragged and dropped, attribute value ranges are manually set, and the binding and logic code between UI controls and attributes are manually written. Database CRUD operations for these business objects also require manually writing SQL statements. The entire development process consumes a significant amount of developers' time and effort and is prone to errors due to manual coding.

[0003] To eliminate the aforementioned problems in large-scale projects like ground warfare development, reduce developer workload, save labor costs, improve development efficiency, accelerate software development, reduce errors that may result from manual coding, and improve software quality, the following metadata design is required. This metadata should describe business objects and their various attributes, including data names, data types, and value ranges. Templates for data class code and interface code need to be designed. An object-relational mapping framework needs to be designed to simplify database operations and facilitate the generation of database operation code. Summary of the Invention

[0004] The purpose of this invention is to provide a tool for automatically generating data display and storage code, which reduces the workload of developers in writing code for a large number of business objects in ground station systems, improves development efficiency, reduces errors in manually writing this part of the code, improves software quality, and reduces costs.

[0005] The objective of this invention is achieved through the following technical solution:

[0006] A data display and code saving automatic generation tool, implemented using Qt, includes business object model management, an object-relational mapping framework, code generation, and database management. Its key features are: a business object model management module for defining metadata and generating model files after the metadata definition is complete; a code generation module that calls built-in templates to generate code after the model file is generated, including entity class code, new form class code, and edit form class code; a database operation class DBEngine provided by the object-relational mapping framework, which contains the new form class code and edit form class code generated by the code generation module; and a database management module that stores the generated code in a database form.

[0007] Based on the above characteristics, the metadata defined in the business object model management module includes business object information and object attribute information;

[0008] Business object information includes the object's class name and comments;

[0009] The object's attribute information includes whether it is a primary key, data name, data type, comments, default value, minimum value, maximum value, step size, precision, optional string, and optional value. Among them, the data types include basic data types and UI types. Basic data types include bool, int, double, and QString, while UI types include UIInt, UIDouble, and UISelect. The basic data types int, double, and QString all correspond to Qt's QLineEdit control, the basic data type bool corresponds to Qt's QCheckBox control, the UI type UIInt corresponds to the QSpinBox control, the UI type UIDouble corresponds to the QDoubleSpinBox control, and the UI type UISelect corresponds to the QComboBox control.

[0010] Based on the above characteristics, the code generation module automatically generates entity class code for business objects using built-in entity class templates, including object constructors, destructors, methods for getting and setting object properties, and comments; it also automatically generates new form class code using built-in new form templates, including constructors, destructors, creation operation functions, cancellation operation functions, and comments; and it automatically generates edit form class code using built-in edit form templates, including constructors, destructors, confirmation operation functions, cancellation operation functions, and comments. The new form class for business objects allows users to create classes of business objects, and the edit form class for business objects allows users to edit the created classes.

[0011] Based on the above features, the code generation module also provides a code preview window for previewing all generated code. By switching between the entity class, new form class, and edit form class tabs, the entity class code, new form class code, and edit form class code can be previewed respectively. The code can be generated to a specified directory and a prompt message can be displayed by clicking the code generation button.

[0012] Based on the above characteristics, the DBEngine class provided by the object-relational mapping framework module obtains the names and values ​​of all object attributes through the pointers of the generated entity classes, automatically concatenates them to complete the SQL statement, and completes the corresponding database operations including adding, deleting, modifying, and querying.

[0013] Based on the above characteristics, the database management module includes functions for updating to the database, database preview, and database configuration. The function for updating to the database directly creates or updates database forms through the model and stores the code in the database forms. The database preview function provides the ability to view all data forms in the database and the corresponding field information of the forms. The database configuration function displays the configuration information of the current database, including the database type, hostname, database name, username, and password.

[0014] The beneficial effects of this invention are as follows:

[0015] This tool is implemented using Qt and supports cross-platform compatibility and multiple databases. Its streamlined object-relational mapping (ORM) framework module provides simple interfaces, enabling database operations without writing SQL statements. Users only need to input business object information and its attributes to automatically generate entity class code, new form class code, and edit form class code. This tool reduces developer workload, improves development efficiency, minimizes errors from manually writing this code, enhances software quality, and lowers costs. The included comments enhance code readability and facilitate subsequent development. Attached Figure Description

[0016] Figure 1 A framework diagram for a tool that automatically generates and displays and saves code.

[0017] Figure 2 New Business Object Model Window Diagram;

[0018] Figure 3 Entity class code preview and code generation interface screenshot;

[0019] Figure 4 Preview of the code for the newly created form class;

[0020] Figure 5 Edit the preview interface of the form class code;

[0021] Figure 6Database preview interface screenshot. Detailed Implementation

[0022] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.

[0023] See Figure 1 As shown in this embodiment, a data display and save code auto-generation tool automatically generates code for business object creation and saving interfaces using Qt. It includes the following program modules: business object model management, object-relational mapping framework, code generation, and database management. The business object model management module is mainly used to define metadata; the code generation module generates code using built-in templates; the object-relational mapping framework mainly provides the database operation class DBEngine, which is included in the code generated by the code generation module for use by the generated new form and edit form classes; the database management module is mainly used for database viewing and database form updates.

[0024] The following provides a detailed description of each program module.

[0025] The business object model management module is used to define metadata and generate model files after the metadata is defined. Metadata is used to create object models and generate model files. Metadata includes business object information and object attribute information. Business object information includes the class name and comments of the business object. Object attribute information includes whether it is a primary key, data name, data type, comments, default value, minimum value, maximum value, step size, precision, optional strings, and optional values. These attributes cover information for all data types. Data types include basic data types and UI types. Basic data types are bool, int, double, and QString. UI types include UIInt, UIDouble, and UISelect. The basic data types int, double, and QString correspond to the Qt QLineEdit control, and the basic type bool corresponds to the Qt QCheckBox control. UI types correspond to commonly used complex UI controls in Qt, with UIInt corresponding to the QSpinBox control, UIDouble corresponding to the QDoubleSpinBox control, and UISelect corresponding to the QComboBox control.

[0026] See Figure 2 As shown, users input business object information in the business object model management module. Object attribute information is created by adding variables, and a JSON model file is generated after editing and confirming the object attribute information. The business object model management module also provides a menu for opening previously generated model files.

[0027] After the business object model management module generates the model file, the code generation module calls the built-in templates to generate code. The metadata object information corresponds to the class's own information, and the object attribute information corresponds to the class's member variable information. The code generation module automatically generates entity class code (h and cpp code) for business objects using the built-in entity class template, including the class constructor, destructor, methods for getting and setting member variables, and comments. It also automatically generates new form class code (h, cpp, and ui code) using the built-in new form template, including the new window's constructor, destructor, creation operation function, cancellation operation function, and comments. Similarly, it automatically generates edit form class code (h, cpp, and ui code) using the built-in edit form template, including the edit window's constructor, destructor, confirmation operation function, cancellation operation function, and comments. The new form class of a business object can be used to create a class of a business object, and the edit form class of a business object can be used to edit the created class.

[0028] The code generation module also provides a code preview window for previewing all generated code. By switching between the entity class, new form class, and edit form class tabs, users can preview the code separately. Figure 3 The entity class code shown Figure 4 The code for the newly created form class shown, and Figure 5 The code for the edit form is shown. The "Generate Code" button generates code to a specified directory and displays a message.

[0029] The Object-Relational Mapping (ORM) framework module includes a class called DBEngine, which enables CRUD operations on business objects in the database without requiring SQL statements. The DBEngine class primarily utilizes Qt's meta-object system, similar to Java reflection, to obtain the names and values ​​of all member variables through pointers to the generated entity classes. This automatically constructs the SQL statements, allowing direct database operations (including CRUD) via object pointers. Leveraging Qt's support for multiple databases, it is also compatible with various databases. The DBEngine class provides simple CRUD operation interfaces, which are included in the generated code in a specified directory for use by the code generator. This allows newly created and editable form classes to easily perform add and modify operations in the database.

[0030] The database management module includes functions for updating to the database, database preview, and database configuration, used for managing and viewing the database for easy use after code generation. The "update to database" function directly creates or updates database forms through the model, storing the code into the database forms. The database preview function provides the ability to view all data forms in the database and their corresponding field information, such as... Figure 6As shown, the database configuration function displays the current database configuration information, including the database type, hostname, database name, username, and password.

[0031] It is understood that those skilled in the art can make equivalent substitutions or modifications to the technical solution and inventive concept of the present invention, and all such substitutions or modifications should fall within the protection scope of the appended claims.

Claims

1. A tool for automatically generating data display and storage code, implemented using Qt, comprising business object model management, object-relational mapping framework, code generation, and database management, characterized in that... The business object model management module is used to define metadata and generate model files after the metadata is defined; the code generation module calls the built-in template to generate code after the model file is generated, including entity class code, new form class code, and edit form class code; the object-relational mapping framework provides the database operation class DBEngine, which contains the new form class code and edit form class code generated by the code generation module; The database management module will generate code and store it in the database form.

2. The data display and storage code automatic generation tool according to claim 1, characterized in that... In the business object model management module, the defined metadata includes business object information and object attribute information; Business object information includes the object's class name and comments; The object's attribute information includes whether it is a primary key, data name, data type, comments, default value, minimum value, maximum value, step size, precision, optional string, and optional value. Among them, the data types include basic data types and UI types. Basic data types include bool, int, double, and QString, while UI types include UIInt, UIDouble, and UISelect. The basic data types int, double, and QString all correspond to Qt's QLineEdit control, the basic data type bool corresponds to Qt's QCheckBox control, the UI type UIInt corresponds to the QSpinBox control, the UI type UIDouble corresponds to the QDoubleSpinBox control, and the UI type UISelect corresponds to the QComboBox control.

3. The data display and storage code automatic generation tool according to claim 1, characterized in that... The code generation module automatically generates entity class code for business objects using built-in entity class templates, including object constructors, destructors, methods for getting and setting object properties, and comments. It also automatically generates new form class code using built-in new form templates, including constructors, destructors, creation and cancellation functions, and comments. Similarly, it automatically generates edit form class code using built-in edit form templates, including constructors, destructors, confirmation and cancellation functions, and comments. The new form class allows users to create classes for business objects, while the edit form class allows users to edit those classes.

4. The data display and storage code automatic generation tool according to claim 1, characterized in that... The code generation module also provides a code preview window for previewing all generated code. By switching between the entity class, new form class, and edit form class tabs, you can preview the entity class code, new form class code, and edit form class code respectively. The generate code button can generate code to a specified directory and provide a prompt.

5. The data display and storage code automatic generation tool according to claim 1, characterized in that... The DBEngine class provided by the Object-Relational Mapping Framework module obtains the names and values ​​of all object attributes through pointers to the generated entity classes, automatically concatenates them to complete SQL statements, and performs corresponding database operations including CRUD operations.

6. The data display and code saving automatic generation tool according to claim 1, characterized in that... The database management module includes functions for updating to the database, database preview, and database configuration. The function for updating to the database directly creates or updates database forms through the model and stores the code in the database forms. The database preview function provides the ability to view all data forms in the database and the corresponding field information of the forms. The database configuration function displays the configuration information of the current database, including the database type, hostname, database name, username, and password.