Method and system for generating UI (User Interface) frame
Dynamically generating UI interfaces through configuration files solves the time-consuming and error-prone problems of UI adjustment and modification in Qt Quick/QML, achieves flexibility and maintainability, and improves development efficiency and software iteration speed.
Patent Information
- Application Number
- CN202411236860.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-10-15
AI Technical Summary
In modern software development, UI component selection, attribute configuration, and layout arrangements in the Qt Quick/QML field are usually determined statically. As a result, when the UI needs to be adjusted or modified, developers must manually update the source code and recompile, resulting in Development efficiency is low and software iteration is slow.
Dynamically organize and generate the user interface through the configuration file, obtain the configuration file of the UI interface to be displayed, generate standard metadata based on the configuration file and preset rules, determine the display components, and configure and display according to the component template library, supporting real-time updates and components Add or replace, eliminating the compilation and packaging steps.
It improves the flexibility and maintainability of UI design, reduces developers' workload and error rate, significantly improves development efficiency and software iteration speed, and reduces the development cycle.
Smart Images

Figure CN118778959A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of software development technology, and in particular to a method and system for generating a UI interface framework. Background Art
[0002] In modern software development, the Qt framework is widely used in the development of various applications due to its powerful cross-platform capabilities and rich function libraries. Especially in the field of Qt Quick / QML, it provides a declarative programming model that allows developers to quickly build dynamic user interfaces through the QML language. However, although Qt Quick / QML provides efficient interface design methods, its component selection, property configuration, and layout arrangement are usually statically determined at the code level.
[0003] This static code determination brings a series of problems. For example, when any minor adjustments or modifications are required to the UI, developers must manually update the source code, then recompile, package, and finally release the new version. This process is not only time-consuming but also prone to errors, which seriously affects development efficiency and software iteration speed.
[0004] In order to solve the above problems, the present invention proposes a method and system for generating a UI interface framework, which allows dynamically organizing and generating a user interface through a configuration file. Summary of the invention
[0005] The embodiments of the present application provide a method and system for generating a UI interface framework, which are used to improve the technical problem in related technologies that the process of adjusting or modifying the UI is time-consuming and error-prone, resulting in low development efficiency and slow software iteration speed.
[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions: In a first aspect, an embodiment of the present application provides a method for generating a UI interface framework, the generating method comprising: obtaining a configuration file of a UI interface to be displayed; generating standard metadata based on the configuration file and preset rules, the preset rules comprising parsing and formatting the configuration file; determining a display component to be displayed on the UI interface to be displayed according to the standard metadata and a component template library, the component template library comprising multiple component templates.
[0007] In this way, through the configuration file, developers can flexibly define UI components and their properties without directly modifying the source code; the configuration file supports real-time updates, and the UI layout can be adjusted instantly according to the configuration changes without recompiling; new components can be easily added or replaced through the configuration file, which greatly improves the flexibility and maintainability of UI design; and because the compilation and packaging steps are omitted, developers can respond to demand changes more quickly and accelerate product iterations, which can significantly reduce the workload of developers in UI design and maintenance and improve work efficiency. At the same time, this method also has the advantages of being easy to learn and use, reducing development cycles, and reducing error rates, which is of great significance to improving the overall quality and efficiency of software development.
[0008] In a possible implementation manner of the first aspect, the standard metadata includes a component type field, a layout field, an initial field, and a Boolean field.
[0009] In a possible implementation manner of the first aspect, the standard metadata further includes a reserved field.
[0010] In a possible implementation of the first aspect, generating standard metadata based on the configuration file and preset rules includes: parsing the configuration file to obtain first data; formatting the first data to obtain the component type field, the layout field, the initial field and the Boolean field.
[0011] In a possible implementation of the first aspect, determining the component to be displayed on the UI interface to be displayed according to the standard metadata and the component template library includes: Acquire the component template to be used according to the component type field; The component template is configured based on the layout field and the initial field to obtain the display component; The enabling state of the component is determined according to the Boolean field, and when the enabling state of the component is enabled, the display component is added to the UI interface to be presented for display.
[0012] In the second aspect, an embodiment of the present application also provides a system for generating a UI interface framework, the generation system comprising: a data processing module, the data processing module being used to receive a configuration file of a UI interface to be displayed, and to generate standard metadata based on the configuration file; a component generation module, the component generation module being coupled to the data processing module, the component generation module being used to generate a display component to be displayed on the UI interface to be displayed according to the standard metadata.
[0013] In a possible implementation of the second aspect, the data processing module generates standard metadata based on the configuration file, including: the data processing module parses the configuration file to obtain first data; the data processing module formats the first data to obtain the component type field, the layout field, the initial field and the Boolean field.
[0014] In a possible implementation of the second aspect, the component generation module generates a display component to be displayed on the UI interface to be displayed according to the standard metadata, including: the component generation module obtains the component template to be used according to the component type field; the component generation module configures the component template based on the layout field and the initial field to obtain the display component; the component generation module determines the enable state of the component according to the Boolean field, and when the enable state of the component is enabled, adds the display component to the UI interface to be displayed for display.
[0015] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory is coupled to the processor, the memory is used to store computer program code, the computer program code comprises computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes a method as described in any one of the first aspects.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute a method as described in any one of the first aspects.
[0017] Compared with the traditional QML development model, the method of the present invention has the following significant advantages: through the configuration file, the developer can flexibly define the UI components and their properties without directly modifying the source code; the configuration file supports real-time updates, and the UI layout can be adjusted instantly according to the configuration changes without recompiling. New components can be easily added or replaced through the configuration file, which greatly improves the flexibility and maintainability of the UI design; and because the compilation and packaging steps are omitted, developers can respond to changes in requirements more quickly and accelerate product iterations, thereby significantly reducing the workload of developers in UI design and maintenance and improving work efficiency. At the same time, this method also has the advantages of being easy to learn and use, reducing the development cycle, and reducing the error rate, which is of great significance for improving the overall quality and efficiency of software development. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of a generation method provided for some embodiments of the present application; Figure 2A schematic diagram of a generation method provided for some embodiments of the present application; Figure 3 A schematic diagram of a generation method provided for some embodiments of the present application; Figure 4 A schematic diagram of the structure of a production system provided for some embodiments of the present application. DETAILED DESCRIPTION
[0019] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0020] In the following, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0021] In addition, in the present application, directional terms such as "up", "down", "left" and "right" may be defined including but not limited to the orientation relative to the schematic placement of the components in the drawings. It should be understood that these directional terms may be relative concepts, which are used for relative description and clarification, and may change accordingly according to the change in the orientation of the components in the drawings.
[0022] In this application, unless otherwise specified or limited, the term "connection" should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium. In addition, the term "electrical connection" can be a way of achieving electrical connection for signal transmission.
[0023] As used herein, “about,” “substantially,” or “approximately” includes the stated value and reference values that are within an acceptable range of deviation from the particular value, where the acceptable range of deviation is as determined by one of ordinary skill in the art taking into account the measurements in question and the errors associated with the measurement of the particular quantity (i.e., the limitations of the measurement system).
[0024] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0025] In modern software development, the Qt framework is widely used in the development of various applications due to its powerful cross-platform capabilities and rich function libraries. Especially in the field of Qt Quick / QML, it provides a declarative programming model that allows developers to quickly build dynamic user interfaces through the QML language. However, although Qt Quick / QML provides efficient interface design methods, its component selection, property configuration, and layout arrangement are usually statically determined at the code level.
[0026] This static code determination brings a series of problems. For example, when any minor adjustments or modifications are required to the UI, developers must manually update the source code, then recompile, package, and finally release the new version. This process is not only time-consuming but also prone to errors, which seriously affects development efficiency and software iteration speed.
[0027] The embodiments of the present application provide a method and system for generating a UI interface framework, which are used to improve the technical problem in related technologies that the process of adjusting or modifying the UI is time-consuming and error-prone, resulting in low development efficiency and slow software iteration speed.
[0028] like Figure 1 As shown, the generating method comprises: S100: Obtain a configuration file of a UI interface to be displayed.
[0029] Exemplarily, the configuration file can be acquired by communicating with the outside through the data processing module 10. The data processing module 10 can be implemented by the C++ programming language.
[0030] S200: Generate standard metadata based on the configuration file and preset rules, where the preset rules include parsing and formatting the configuration file.
[0031] Exemplarily, after the data processing module 10 obtains the configuration file, it will process the configuration file according to the preset rules. For example, the configuration file is parsed and formatted to obtain the standard metadata required by the subsequent modules. The standard metadata may include a component type field, a layout field, an initial field, and a Boolean field.
[0032] The component type field is used to identify the type of component used. The layout field can define the margins of the component for layout purposes. The initial field can represent the initial value or state of the component. The Boolean field can be used to indicate whether the component is enabled.
[0033] Exemplarily, generating standard metadata based on the configuration file and preset rules includes: S210: Parse the configuration file to obtain first data.
[0034] S220. Format the first data to obtain the component type field, the layout field, the initial field and the Boolean field.
[0035] In some other examples, the standard metadata may further include reserved fields. The reserved fields may be used for complex logic or initialization.
[0036] S300: Determine a display component to be displayed on the UI interface to be displayed according to the standard metadata and a component template library, wherein the component template library includes a plurality of component templates.
[0037] The data processing module 10 processes the configuration file, obtains the standard metadata, and then sends the standard metadata to the component generation module 20. The component generation module 20 selects the corresponding component template from the component template library according to the component type field in the standard metadata, adjusts the layout of the component template according to the initial field and the layout field, and finally determines whether the corresponding component template is a display component for displaying on the UI interface according to the Boolean field.
[0038] In some embodiments, determining the component to be displayed on the UI interface to be displayed according to the standard metadata and the component template library includes: S310. Obtain a used component template according to the component type field.
[0039] Exemplarily, the component generation module 20 may have a component template library built in, or may be coupled to an external component template library. The component template library may store a variety of component templates. The component generation module 20 selects a corresponding component template from the component template library according to the component type field in the standard metadata.
[0040] S320: Configure the component template based on the layout field and the initial field to obtain the display component.
[0041] Exemplarily, after selecting the corresponding component template, the component generation module 20 lays out the component template according to the initial field and layout field corresponding to the component template to obtain a display component that can be used for display on the UI interface, such as adjusting the margin of the component template.
[0042] S330: Determine the enablement state of the component according to the Boolean field, and when the enablement state of the component is enabled, add the display component to the UI interface to be displayed.
[0043] Exemplarily, after defining the display component, the component generation module 20 determines whether the display component is enabled, that is, whether it needs to be displayed on the UI interface, according to the corresponding Boolean field.
[0044] In this way, the present application can realize the framework of dynamically organizing code to generate UI interface through configuration files, and can directly modify configuration files, so as to arbitrarily combine and match, adjust the layout according to the currently existing components, and realize UI interface display. Through the configuration file, developers can flexibly define UI components and their properties without directly modifying the source code; the configuration file supports real-time updates, and the UI layout can be adjusted instantly according to configuration changes without recompiling. New components can be easily added or replaced through configuration files, which greatly improves the flexibility and maintainability of UI design; and because the compilation and packaging steps are omitted, developers can respond to changes in requirements more quickly and accelerate product iteration, thereby significantly reducing the workload of developers in UI design and maintenance and improving work efficiency. At the same time, this method also has the advantages of being easy to learn and use, reducing development cycles, and reducing error rates, which is of great significance to improving the overall quality and efficiency of software development.
[0045] In a second aspect, an embodiment of the present application further provides a system for generating a UI interface framework, the system comprising a data processing module 10 and a component generating module 20 .
[0046] The data processing module 10 is used to receive a configuration file of a UI interface to be displayed, and generate standard metadata based on the configuration file.
[0047] Exemplarily, the data processing module 10 communicates with the outside to obtain the configuration file. The data processing module 10 can be implemented by the C++ programming language. After the data processing module 10 obtains the configuration file, it will process the configuration file according to the preset rules. For example, the configuration file is parsed and formatted to obtain the standard metadata required by the subsequent modules. The standard metadata may include a component type field, a layout field, an initial field, and a Boolean field.
[0048] The component type field is used to identify the type of component used. The layout field can define the margins of the component for layout purposes. The initial field can represent the initial value or state of the component. The Boolean field can be used to indicate whether the component is enabled.
[0049] Exemplarily, generating standard metadata based on the configuration file and preset rules includes: parsing the configuration file to obtain first data, formatting the first data to obtain the component type field, the layout field, the initial field, and the Boolean field.
[0050] In some other examples, the standard metadata may further include reserved fields. The reserved fields may be used for complex logic or initialization.
[0051] A component generation module 20 is coupled to the data processing module 10 and is used to generate a display component displayed on the UI interface to be displayed according to the standard metadata. The component generation module 20 can be implemented by writing in the QML programming language.
[0052] In some embodiments, the component generation module 20 generates a display component to be displayed on the UI interface to be displayed according to the standard metadata, including: the component generation module 20 obtains the component template to be used according to the component type field; the component generation module 20 configures the component template based on the layout field and the initial field to obtain the display component; the component generation module 20 determines the enable state of the component according to the Boolean field, and when the enable state of the component is enabled, adds the display component to the UI interface to be displayed for display.
[0053] Exemplarily, the data processing module 10 processes the configuration file, obtains the standard metadata, and then sends the standard metadata to the component generation module 20. The component generation module 20 selects a corresponding component template from the component template library according to the component type field in the standard metadata, adjusts the layout of the component template according to the initial field and the layout field, and finally determines whether the corresponding component template is a display component for display on the UI interface according to the Boolean field.
[0054] In some embodiments, determining the component to be displayed on the UI interface to be presented according to the standard metadata and the component template library includes acquiring the component template to be used according to the component type field.
[0055] Exemplarily, the component generation module 20 may have a component template library built in, or may be coupled to an external component template library. The component template library may store a variety of component templates. The component generation module 20 selects a corresponding component template from the component template library according to the component type field in the standard metadata.
[0056] The component template is configured based on the layout field and the initial field to obtain the display component. Exemplarily, after the component generation module 20 selects the corresponding component template, it lays out the component template according to the initial field and layout field corresponding to the component template to obtain a display component that can be used for display on the UI interface. For example, the margin of the component template is adjusted.
[0057] The enablement state of the component is determined according to the Boolean field, and when the enablement state of the component is enabled, the display component is added to the UI interface to be displayed for display. Exemplarily, after the component generation module 20 defines the display component, it determines whether the display component is enabled, that is, whether it needs to be displayed on the UI interface, according to the corresponding Boolean field.
[0058] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory is coupled to the processor, the memory is used to store computer program code, the computer program code comprises computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes a method as described in any one of the first aspects.
[0059] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute a method as described in any one of the first aspects.
[0060] In this way, through the configuration file, developers can flexibly define UI components and their properties without directly modifying the source code; the configuration file supports real-time updates, and the UI layout can be adjusted instantly according to the configuration changes without recompiling; new components can be easily added or replaced through the configuration file, which greatly improves the flexibility and maintainability of UI design; and because the compilation and packaging steps are omitted, developers can respond to demand changes more quickly and accelerate product iterations, which can significantly reduce the workload of developers in UI design and maintenance and improve work efficiency. At the same time, this method also has the advantages of being easy to learn and use, reducing development cycles, and reducing error rates, which is of great significance to improving the overall quality and efficiency of software development.
[0061] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that the diagnostic method in the above embodiment can be implemented by software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of various embodiments of the present invention.
[0062] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0063] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0064] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0065] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated units may be implemented in the form of hardware.
[0066] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for generating a UI interface framework, It is characterized in that The generation method comprises: Get the configuration file of the UI interface to be displayed; Generate standard metadata based on the configuration file and preset rules, wherein the preset rules include parsing and formatting the configuration file; The display component to be displayed on the UI interface to be displayed is determined according to the standard metadata and a component template library, wherein the component template library includes a plurality of component templates.
2. The generation method according to claim 1, It is characterized in that The standard metadata includes a component type field, a layout field, an initial field, and a Boolean field.
3. The generation method according to claim 2, It is characterized in that The standard metadata includes reserved fields.
4. The generation method according to claim 2, It is characterized in that Generating standard metadata based on the configuration file and preset rules includes: Parsing the configuration file to obtain first data; The first data is formatted to obtain the component type field, the layout field, the initial field and the Boolean field.
5. The generation method according to claim 4, It is characterized in that The determining the component to be displayed on the UI interface to be displayed according to the standard metadata and the component template library includes: Acquire the component template to be used according to the component type field; The component template is configured based on the layout field and the initial field to obtain the display component; The enabling state of the component is determined according to the Boolean field, and when the enabling state of the component is enabled, the display component is added to the UI interface to be presented for display.
6. A UI interface framework generation system, It is characterized in that The generation system comprises: A data processing module, the data processing module is used to receive a configuration file of the UI interface to be displayed, and generate standard metadata based on the configuration file; A component generation module, the component generation module is coupled to the data processing module, and the component generation module is used to generate a display component displayed on the UI interface to be displayed according to the standard metadata.
7. The generation system according to claim 6, It is characterized in that The data processing module generates standard metadata based on the configuration file, including: The data processing module parses the configuration file to obtain first data; The data processing module formats the first data to obtain the component type field, the layout field, the initial field and the Boolean field.
8. The generation method according to claim 7, It is characterized in that The component generation module generates a display component to be displayed on the UI interface to be displayed according to the standard metadata, including: The component generation module obtains the component template to be used according to the component type field; The component generation module configures the component template based on the layout field and the initial field to obtain the display component; The component generation module determines the enablement state of the component according to the Boolean field, and when the enablement state of the component is enabled, adds the display component to the UI interface to be displayed.
9. An electronic device, It is characterized in that It includes a processor and a memory, the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor reads the computer instructions from the memory, the electronic device executes the method as described in any one of claims 1-5.
10. A computer-readable storage medium, It is characterized in that The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 5.
Citation Information
Cited By
Page rendering method and device based on template configuration
CN119440527A
