A parameter control method under the QT framework
By defining the types and interfaces of functional controls under the QT framework, using XML files and signal and slot communication mechanisms, the flexibility and efficiency of device parameter control in a domestic cross-platform environment is solved, and a cross-platform and easy-to-scaling device parameter control method is realized.
Patent Information
- Application Number
- CN202211462106.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-11-22
AI Technical Summary
The existing technology is difficult to quickly generate human-computer interactive interfaces in a domestic cross-platform environment, and cannot meet the flexible and efficient needs of control of multiple differentiated equipment parameters.
Based on the QT framework, the types and interfaces of functional controls are defined, XML is used to describe and generate local files, and interface layout and business logic are realized in combination with the signal and slot communication mechanism, supporting cross-platform device parameter control.
It realizes a cross-platform, easy to expand and strong reusability parameter control method, improves the development efficiency of device parameter control and the flexibility of interface generation, and adapts to the control needs of diversified equipment.
Smart Images

Figure CN115718557B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of information transmission and processing, and particularly relates to a parameter control method under the QT framework, which is suitable for controlling various differential device parameters in a domestic cross-platform environment, quickly generating a human-computer interaction interface, and providing support for effectively controlling diversified devices. Background Art
[0002] QT is a cross-platform C++ application development framework, and its cross-platform feature enables it to support various operating systems including Windows, Linux, and Galaxy Kylin. In a domestic cross-platform environment, for parameter control of information devices, there are usually the following three QT interface design methods: manually writing and creating interface code, designing with the QT Designer interface editor, and dynamically loading UI files to generate an interface.
[0003] When using manual creation of interface code, it is necessary to select a class from the existing GUI class library as the base class for inheritance and add necessary other members. Manually create other controls on the main form, use a layout manager to layout these controls, and finally set this layout as the layout of the main form. This method is relatively complex and not intuitive enough. When using the QT Designer interface editor for interface design, all operations adopt associable signals and slots and set the properties of specific controls. By directly dragging and dropping controls and setting the properties of the controls, it is simple, intuitive, and easy to operate. For the method of dynamically loading UI files, it is necessary to first design the interface using QT Designer, and then use the dynamic loading feature of UiLoader to dynamically load the maintained.UI files.
[0004] The first two methods require corresponding files or codes to be created in advance and then compiled with other files. If the interface needs to be modified later, the code must be modified and recompiled. The third method only needs to modify the.UI file when modifying the interface and does not require recompilation, but the property modification does not have sufficient flexibility. When adapting to the control of various differential device parameters, these three methods all have certain limitations and cannot meet the requirement of quickly generating a human-machine interface. Therefore, a flexible, efficient, and extensible parameter control method in a domestic environment is needed. Summary of the Invention
[0005] The present invention proposes a parameter control method under the QT framework in view of the deficiencies of the prior art, which can realize the control of various differential device parameters in a domestic cross-platform environment, quickly generate a human-computer interaction interface, and provide support for effectively controlling diversified devices.
[0006] To achieve the above object, the technical solution adopted by the present invention is as follows:
[0007] A parameter control method under the QT framework, comprising the following steps:
[0008] Step 1, define function controls based on the QT framework, determine the types of function controls, clarify the general interfaces and differentiated interfaces of different types of function controls, and perform function overloading for different types of function controls respectively, including main form definition, main form creation, interface element creation, main form display, message response, and interface data processing, to form a function control library;
[0009] Step 2, select function controls based on the function control library to form a function control set, describe it using XML, and generate a local file;
[0010] Step 3, parse the local file, obtain the parameter information of the function control set, and dynamically create the function controls after function overloading based on the parameter information to complete the interface layout;
[0011] Step 4, when the attributes of the function controls in the interface change, encapsulate the control ID corresponding to the function control and the changed content of the parameters, and send a Signal signal for message passing;
[0012] Step 5, connect the slot with the Signal signal, establish a service association using the signal and slot communication mechanism under the QT framework, and trigger the service logic of the function control based on the control ID and parameters;
[0013] Complete the parameter control under the QT framework.
[0014] Furthermore, in Step 1, define function controls based on the QT framework, determine the types of function controls, clarify the general interfaces and differentiated interfaces of different types of function controls, specifically including the following steps:
[0015] Step 101, define the control types and layout modes of function controls based on the QT framework. The control types include: divider, edit box, dropdown box, radio box, expansion box, switch box, label, and switch; the layout modes include: list layout and tree layout, where the list layout supports horizontal layout and vertical layout;
[0016] Step 102, clarify the general interfaces of different types of function controls: define the general structure of the corresponding parameters of the function controls, including control ID, parent ID, label name, conversion unit, control type, display or not, numerical type, numerical ratio, and default value, where the control ID is globally unique;
[0017] Step 103, design the differentiated interfaces of function controls: for function controls with special usage requirements, perform differentiated interface design, including: adding the maximum data value and minimum data value to the edit box, adding default text to the expansion box, and adding one or more container values to the dropdown box;
[0018] Step 104, design the interaction interface between functional controls: Associate the functional controls with a linkage relationship. When a functional control changes, the associated functional control will change accordingly. In addition, define the enabling modes between the associated functional controls, where the supported enabling modes include parameter availability, parameter invalidation, reset value range, parameter display, and parameter hiding.
[0019] Further, in Step 2, it is described using XML to generate a local file, which specifically includes the following steps:
[0020] Step 201, in combination with the business usage requirements, sequentially complete the instantiation of the functional controls in the functional control set to form a local XML file;
[0021] Step 202, based on the interface design, open the interfaces that need to be used in the XML file and complete the initialization;
[0022] Step 203, for different functional control instances, assign values to the interface parameters in the XML file;
[0023] Step 204, define the enabling modes for the functional controls with a linkage relationship in the XML file, supplement the association relationship, and form the final local file.
[0024] Further, Step 3 specifically includes the following steps:
[0025] Step 301, load the local file, perform format verification and XML parsing on the file, and obtain each functional control entity C in the functional control set i , where i = 1, 2,..., N, and N is the number of functional controls;
[0026] Step 302, determine the layout mode parameters and group the functional controls by type at the same time;
[0027] Step 303, create the main form corresponding to each functional control entity C i , assign values to the member variables of each functional control entity according to the interface parameter values and update the GUI display, and complete the dynamic creation of the entire GUI interface; if the dynamically created GUI interface does not meet the business requirements, return to Step 2 until the functional control configuration update is completed, and display the functional controls in the same group according to the layout mode.
[0028] Further, Step 5 specifically includes the following steps:
[0029] Step 501: For the same type of Signal signals of different functional control entities, utilize the signal and slot communication mechanism under the QT framework to associate them through a unified slot function. The same signal is connected to one or more slots, and at the same time, the same slot responds to one or more signals.
[0030] Step 502: Utilize the control ID of the functional control entity to implement differential business logic processing for different functional control entities in the slot function, and achieve targeted business capabilities.
[0031] Step 503: Utilize the control ID of the functional control entity to call the Get function to obtain the parameter values of the corresponding interface, or call the Set function to complete the re-assignment of specific interfaces, and achieve parameter overloading of the functional control.
[0032] Step 504: In different usage scenarios, for differential equipment control requirements, modify the functional control instances and interface parameters in the local configuration file in Step 204 to generate a new local file for subsequent processing. If the relevant parameter control processing still does not meet the business usage requirements, return to Step 1 to expand the types of functional controls until the new business usage requirements are met.
[0033] Compared with the prior art, the present invention has the following advantages:
[0034] 1. Cross-platform: The platform independence of the XML language makes it a standard for cross-platform data representation and exchange. The present invention is based on the XML local configuration file and the signal and slot communication mechanism under QT to meet the equipment control requirements in different scenarios, meets the requirements of self-control in the domestic environment, and has stronger cross-platform characteristics.
[0035] 2. High efficiency: The present invention supports rapid interface generation and rapid association processing of business logic through flexible configuration loading and parsing, has strong reusability, and improves the development efficiency of equipment parameter control.
[0036] 3. Easy to expand: The present invention supports customization of the parameter control interface by modifying the local configuration, can quickly respond to the changes in the human-computer interaction interface, and reflects strong maintainability and easy expansion capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is the overall flowchart of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0038] Refer to Figure 1, A parameter control method under the QT framework, including a series of processing procedures such as defining the types and interfaces of functional controls based on QT, implementing and forming a functional control library, selecting functional controls to form a local XML file, dynamically creating functional controls to implement the interface layout, performing message passing when the attributes of functional controls change, and triggering the business logic of functional controls. Specifically, it includes the following steps:
[0039] (1) Define functional controls based on the QT framework, determine the types of functional controls, and clarify the general interfaces and differentiated interfaces of different types of functional controls; and for different types of functional controls, perform function overloading respectively, including main form definition, main form creation, interface element creation, main form display, message response, and interface data processing, to form a functional control library;
[0040] Among them, defining functional controls based on the QT framework, determining the types of functional controls, and clarifying the general interfaces and differentiated interfaces of different types of functional controls specifically include the following steps:
[0041] (101) Define the control types and layout modes of functional controls based on the QT framework. The control types include: separator, edit box, dropdown box, radio box, expansion box, switch box, label, and switch; the layout modes include: list layout and tree layout, where the list layout supports horizontal layout and vertical layout;
[0042] (102) Clarify the general interfaces of different types of functional controls: Define the general structure of the corresponding parameters of functional controls, including control ID, parent ID, label name, conversion unit, control type, display or not, value type, value ratio, and default value, where the control ID is required to be globally unique;
[0043] (103) Design the differentiated interfaces of functional controls: For functional controls with special usage requirements, perform differentiated interface design, including: adding the maximum data value and minimum data value to the edit box; adding default text to the expansion box; adding one or more container values to the dropdown box;
[0044] (104) Design the interaction interfaces between functional controls: Associate functional controls with linkage relationships. When a functional control changes, the associated functional controls will change accordingly; and define the enabling modes between the associated functional controls, where the supported enabling modes include parameter available, parameter invalid, reset value range, parameter display, and parameter hidden.
[0045] (2) Select functional controls based on the functional control library to form a set of functional controls C, describe them using XML, and generate a local file;
[0046] Among them, describing using XML and generating a local file specifically includes the following steps:
[0047] (201) Complete the instantiation of the function controls in the function control set C in sequence according to the combined business usage requirements to form a local XML file;
[0048] (202) Based on the interface design, open the interfaces to be used in the XML file and complete the initialization;
[0049] (203) Assign values to the interface parameters in the XML file for different function control instances;
[0050] (204) Define the enabling mode for the function controls with linkage relationships in the XML file, supplement the association relationships, and form the final local file.
[0051] (3) Parse the local file, obtain the parameter information of the function control set C, and dynamically create the function controls after function overloading based on the parameter information to complete the interface layout;
[0052] Specifically, it includes the following steps:
[0053] (301) Load the local file, perform format verification and XML parsing on the file, and obtain each function control entity C in the function control set C i , where i = 1, 2,..., N, and N is the number of function controls;
[0054] (302) Determine the layout mode parameters and group the function controls by type at the same time;
[0055] (303) Create the main form corresponding to each function control entity C i Assign values to the member variables of each function control entity according to the interface parameter values and update the UI display to complete the dynamic creation of the entire GUI interface; if the dynamically created GUI interface does not meet the business requirements, return to step (2) until the function control configuration is updated, and display the function controls in the same group according to the layout mode.
[0056] (4) When the attributes of the function controls in the interface change, encapsulate the control ID corresponding to the function control and the changed content of the parameters, and send a Signal signal for message passing;
[0057] (5) Use a custom slot to connect to the Signal signal, establish a business association using the signal and slot communication mechanism under QT, and trigger the business logic of the function control based on the control ID and parameters;
[0058] Specifically, it includes the following steps:
[0059] (501) For the same type of Signal for different functional control entities, use the signal and slot communication mechanism in QT to associate them through a unified slot function. The same signal is connected to one or more slots, and at the same time, the same slot responds to one or more signals;
[0060] (502) Use the control ID of the functional control entity to implement different business logic processing for different functional control entities in the slot function, and achieve targeted business capabilities;
[0061] (503) Use the control ID of the functional control entity to call the Get function to obtain the parameter value of the corresponding interface, or call the Set function to complete the re-assignment of a specific interface, and achieve parameter overloading of the functional control;
[0062] (504) In different usage scenarios, for different equipment control requirements, by modifying the functional control instances and interface parameters in the local configuration file in step (204), generate a new local file for subsequent processing; if the relevant parameter control processing still does not meet the business usage requirements, then execute step (1) to expand the types of functional controls until the new business usage requirements are met.
[0063] In summary, the present invention realizes the control process for equipment parameters in the domestic cross-platform environment, including a series of processing processes such as defining the types and interfaces of functional controls based on QT, implementing and forming a functional control library, selecting functional controls to form a local XML file, dynamically creating functional controls to achieve interface layout, message passing for changes in functional control attributes, and triggering the business logic of functional controls. The present invention uses the signal and slot communication mechanism in QT to realize the business requirements of controlling equipment parameters using multiple controls in different usage scenarios, and has good adaptability and scalability. The present invention has the advantages of cross-platform, easy expansion, strong reusability, etc., can significantly improve the efficiency of business design and development, and makes the man-machine interface for parameter control friendly, convenient, flexible, and consistent.
Claims
1. A parameter control method under the QT framework, characterized in that It includes the following steps: Step 1: Define function controls based on the QT framework, determine the types of function controls, clarify the common interfaces and differentiated interfaces of different types of function controls, and perform function overloading for different types of function controls respectively, including main form definition, main form creation, interface element creation, main form display, message response, and interface data processing, to form a function control library; Step 2: Select function controls based on the function control library to form a function control set, describe it using XML, and generate a local file; Step 3: Parse the local file, obtain the parameter information of the function control set, and dynamically create the function controls after function overloading based on the parameter information to complete the interface layout; Step 4: When the properties of the function controls in the interface change, encapsulate the control ID corresponding to the function control and the changed content of the parameters, and send a Signal signal for message passing; Step 5: Connect the slot with the Signal signal, establish a service association using the signal and slot communication mechanism under the QT framework, and trigger the service logic of the function control based on the control ID and parameters; specifically, it includes the following steps: Step 501: For the same type of Signal signal of different function control entities, use the signal and slot communication mechanism under the QT framework to associate them through a unified slot function. One signal is connected to one or more slots, and at the same time, one slot responds to one or more signals; Step 502: Use the control ID of the function control entity to implement differentiated service logic processing for different function control entities in the slot function to achieve targeted service capabilities; Step 503: Use the control ID of the function control entity to call the Get function to obtain the parameter value of the corresponding interface, or call the Set function to complete the re-assignment of a specific interface to achieve parameter overloading of the function control; Step 504: In different usage scenarios, for differentiated equipment control requirements, modify the function control instances and interface parameters in the local configuration file to generate a new local file for subsequent processing; if the relevant parameter control processing still does not meet the service usage requirements, return to Step 1 to expand the types of function controls until the new service usage requirements are met; Complete parameter control under the QT framework.
2. The parameter control method under a QT framework according to claim 1, wherein In Step 1, define function controls based on the QT framework, determine the types of function controls, and clarify the common interfaces and differentiated interfaces of different types of function controls. Specifically, it includes the following steps: Step 101: Define the control types and layout modes of function controls based on the QT framework. The control types include: divider, edit box, dropdown box, radio box, expansion box, switch box, label, and switch; the layout modes include: list layout and tree layout, where the list layout supports horizontal layout and vertical layout; Step 102: Clarify the common interfaces of different types of function controls: Define the common structure body of the corresponding parameters of the function control, including control ID, parent ID, label name, conversion unit, control type, display or not, value type, value ratio, and default value, where the control ID is globally unique; Step 103, design the differentiated interfaces of functional controls: For functional controls with special usage requirements, conduct differentiated interface design, including: adding the maximum and minimum data values to the edit box, adding default text to the expansion box, and adding one or more container values to the drop-down box; Step 104, design the interaction interfaces between functional controls: Associate functional controls with linkage relationships. When a functional control changes, the associated functional control will change accordingly; in addition, define the enabling modes between the associated functional controls, where the supported enabling modes include parameter availability, parameter invalidation, resetting the value range, parameter display, and parameter hiding.
3. The parameter control method under a QT framework according to claim 2, characterized in that, Step 2 is described using XML to generate a local file, which specifically includes the following steps: Step 201, in combination with the business usage requirements, sequentially complete the instantiation of the functional controls in the functional control set to form a local XML file; Step 202, based on the interface design, open the interfaces that need to be used in the XML file and complete the initialization; Step 203, for different functional control instances, assign values to the interface parameters in the XML file; Step 204, define the enabling modes for the functional controls with linkage relationships in the XML file, supplement the association relationships, and form the final local file.
4. A parameter control method under the QT framework according to claim 3, characterized in that Step 3 specifically includes the following steps: Step 301: Load the local file, perform format verification and XML parsing on the file, and obtain each function control entity C in the function control set i , where i = 1, 2,..., N, and N is the number of function controls; Step 302, determine the layout mode parameters and group the functional controls by type; Step 303: Create each functional control entity C i Create the corresponding main form, assign values to the member variables of each functional control entity according to the interface parameter values, and update the UI display to complete the dynamic creation of the entire GUI interface; if the dynamically created GUI interface does not meet the business requirements, return to Step 2 until the functional control configuration is updated, and display the functional controls in the same group according to the layout mode.
Citation Information
Patent Citations
Control capture method and equipment
CN104598282A
Data interaction method for control and performance function in application program customization function interface
CN110688187A
Cited By
QT control management method and system based on dynamic binding
CN121143836A