CN108228287B - QT-based user interface control generation method and device - Google Patents
QT-based user interface control generation method and device Download PDFInfo
- Publication number
- CN108228287B CN108228287B CN201611160188.1A CN201611160188A CN108228287B CN 108228287 B CN108228287 B CN 108228287B CN 201611160188 A CN201611160188 A CN 201611160188A CN 108228287 B CN108228287 B CN 108228287B
- Authority
- CN
- China
- Prior art keywords
- control
- user
- control element
- user interface
- displaying
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
Abstract
The invention provides a QT-based user interface control generation method and device, wherein the method comprises the following steps: displaying a control generation interface and a control element list of control elements according to classes when a starting command is received; displaying a control element list corresponding to the control type in the control element list according to the control type selected by a user on a control generation interface; selecting a dragging operation according to a control element of a user, and displaying a target control element to the control generation interface; and combining the selected multiple target control elements to form a user interface control according to the control element combination operation of the user. The method has the advantages of simple operation, visualized process and high code reuse rate, and can automatically generate the corresponding source code and plug-in while generating the type of the user interface control so as to realize cross-platform use and QT compatibility, thereby improving the development efficiency of the user interface control.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a QT-based user interface control generation method and device.
Background
The existing embedded device needs a user interaction interface with individuality and characteristics more and more, wherein the core of the mainstream user interaction interface design is the control technology. In order to provide a better user experience, some personalized user interface controls typically need to be designed.
The existing way to design some personalized complex user interface controls is: and creating a control project by utilizing a Qt Creator to generate the custom control, wherein the Qt Creator is a cross-platform integrated development environment. However, the method for designing the user interface control needs developers to write corresponding codes to realize the required personalized complex user interface control, the workload is very large, the operation is complex, the code reuse rate is low, and the design of the user interface control can only be realized by handwriting the codes, so that whether the final control is the same as the expected control or not cannot be seen in the design process of the control.
Disclosure of Invention
The QT-based user interface control generation method and device have the advantages of simplicity in operation, process visualization and high code reuse rate, and the corresponding source code and plug-in are automatically generated while the type of the user interface control is generated, so that cross-platform use and QT compatibility are realized, and the development efficiency of the user interface control can be improved.
In a first aspect, the present invention provides a QT-based user interface control generation method, including:
when a starting command is received, displaying a control generation interface and a control element list, wherein the control element list displays control elements according to classes; wherein the control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class;
displaying a control element corresponding to the control type in the control element list according to the control type selected by a user on a control generation interface;
displaying a target control element to the control generation interface according to the selection and dragging operation of a user;
and combining the multiple target control elements according to the element combination operation of the user to form the user interface control.
In a second aspect, the present invention provides an apparatus for generating a user interface control, the apparatus comprising a first display module, a selection module, a second display module, and a combination module, wherein,
the first display module is used for displaying a control generation interface and a control element list when a starting command is received, wherein the control element list displays control elements according to classes; wherein the control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class;
the selection module is used for displaying the control element corresponding to the control type in the control element list according to the control type selected by the user on the control generation interface;
the second display module is used for displaying the target control element to the control generation interface according to the selection and dragging operation of the user;
and the combination module is used for combining the multiple target control elements according to the element combination operation of the user to form the user interface control.
According to the QT-based user interface control generation method and device provided by the embodiment of the invention, the control generation interface and the control element list of the control elements are displayed by classes when the starting command is received; wherein the control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class; displaying a control element corresponding to the control type in the control element list according to the control type selected by a user on a control generation interface; displaying a target control element to the control generation interface according to the selection and dragging operation of a user; and combining the multiple target control elements according to the element combination operation of the user to form the user interface control. Compared with the prior art, on one hand, the user interface control can be generated only by selecting the control element according to needs of the user, and the user does not need to manually write codes, so that the control generation scheme is simple to operate and is visual in operation, namely, the user can see the real effect of the control in the control generation process; on the other hand, the visual user interface control is generated, the corresponding source code and the plug-in are also automatically generated, the source code can be directly applied to other platforms for use, and the plug-in can be compatible with the QT, so that the code reuse rate is improved. In conclusion, the QT-based user interface control generation method and device can improve the development efficiency of the user interface control.
Drawings
FIG. 1 is a flowchart of an embodiment of a QT-based user interface control generation method of the present invention;
FIG. 2 is a flowchart of another embodiment of a QT-based user interface control generation method of the present invention;
FIG. 3 is a visual user interface for generating a user interface control according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an embodiment of a QT-based user interface control generation apparatus of the present invention;
FIG. 5 is a schematic structural diagram of another embodiment of the QT-based user interface control generation apparatus of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Qt is a cross-platform C + + graphical user interface application program framework, and the invention provides a QT-based user interface control generation method and device.
The invention provides a QT-based user interface control generation method, as shown in FIG. 1, the method comprises the following steps:
and S11, when the starting command is received, displaying a control generation interface and a control element list of control elements according to classes.
The control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class.
And S12, displaying the control element corresponding to the control type in the control element list according to the control type selected by the user on the control generation interface.
And S13, displaying the target control element to the control generation interface according to the selection and the dragging operation of the user.
And S14, combining the multiple target control elements according to the element combination operation of the user to form the user interface control.
Compared with the prior art, on one hand, the QT-based user interface control generation method provided by the embodiment of the invention can generate the user interface control only by selecting the control element according to needs of a user without manually compiling codes by the user, so that the control generation scheme provided by the invention is simple to operate and is visualized in operation, namely, the user can see the real effect of the control in the control generation process, thereby improving the development efficiency of the user interface control.
Optionally, the control types include background, foreground, pointer, scale, dial, chart, and/or curve.
Optionally, the displaying the target control element to the control generation interface according to the selection and dragging operation of the user includes:
determining the display position of the target control element according to the selection dragging action of the user;
and calling a drawing function through a drawing event function to realize the display of the target control element at the corresponding position.
Further, after the step of S11, the method further includes:
and when a starting command is received, displaying an attribute setting window, wherein the attribute setting window is a floating window.
Correspondingly, the step S14 specifically includes:
and setting the attributes of the target control elements according to a control attribute command set in the attribute setting window by a user, wherein the attributes comprise a maximum value, a minimum value and a coordinate value.
For example, taking a user interface control of the dial plate type as an example, control elements to be set include a pointer, a scale, and the like, and specifically, a current value of the pointer is set, a scale range of the dial plate is set, and the like.
Therefore, the user can flexibly modify the attributes of the control elements and see the real effect of the formed user interface control, and therefore, the user can test the control effect in real time in the user interface control generation scheme.
Further, as shown in fig. 2, after S14, the method further includes:
s15, exporting a source code file corresponding to the user interface control according to a source code file exporting command of a user; and/or exporting the plug-in corresponding to the user interface control according to a plug-in export command of a user.
Therefore, a user can export a source code file or a plug-in corresponding to the user interface control as required, wherein the exported source code, such as source codes in formats of C + +, XML and the like, can be used across platforms, and the exported plug-in can be compatible with QT, namely similar to newly establishing a QT library for QT use, so that the code reuse rate is improved.
When the embodiment of the present invention is applied to generate a visual user operation interface of a user interface control, as shown in fig. 3, the user operation interface includes a control generation interface, a control element list, and a property setting window of a control element.
1) When the user operation interface receives a starting command, a control generation interface, a control element list for displaying control elements by types and a property setting window for the control elements are displayed on the user operation interface.
The control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class.
2) In addition, a control type menu (not shown in fig. 3) for a user to select is further provided on the user operation interface, and when the user selects a certain control type from the control type menu, a control element corresponding to the control type is displayed in the control element list.
3) Then, the user can generate an interface by dragging the required target control element from the control element list to the control.
4) When the user moves the mouse to the target control element, the attribute setting window of the control element can be suspended on the user operation interface, so that the user can conveniently set the attribute of the target control element, and the real effect of the user interface control can be displayed.
The invention provides a QT-based user interface control generation device, which comprises a first display module 11, a selection module 12, a second display module 13 and a combination module 14, as shown in FIG. 4.
The display module 11 is configured to display a control generation interface and a control element list when a start command is received, where the control element list displays control elements according to categories; wherein the control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class;
the selection module 12 is configured to display, in the control element list, a control element corresponding to a control type according to the control type selected by the user on the control generation interface;
the second display module 13 is configured to display a target control element to the control generation interface according to a selection and dragging operation of a user;
the combining module 14 is configured to combine multiple target control elements according to element combining operations of a user to form a user interface control.
Compared with the prior art, on one hand, the QT-based user interface control generation device provided by the embodiment of the invention can generate the user interface control only by selecting the control element according to the needs of the user without manually compiling codes by the user, so that the control generation scheme provided by the invention is simple to operate and visual in operation, namely, the user can see the real effect of the control in the control generation process, thereby improving the development efficiency of the user interface control.
Optionally, the control types include background, foreground, pointer, scale, dial, chart, and/or curve.
Optionally, the second display module comprises a determination unit and a display unit, wherein,
the determining unit is used for determining the display position of the target control element according to the selection dragging action of the user;
and the display unit is used for calling a drawing function through a drawing event function to realize the display of the target control element at the corresponding position.
Further, the apparatus further comprises a third display module, wherein,
the third display module is used for displaying an attribute setting window when a starting command is received, wherein the attribute setting window is a floating window;
correspondingly, the combination module is used for setting the attributes of each of the plurality of target control elements in the user interface control according to the control attribute setting command set in the attribute setting window by the user, wherein the attributes comprise the maximum and minimum values and the coordinate values.
For example, taking a user interface control of the dial plate type as an example, control elements to be set include a pointer, a scale, and the like, and specifically, a current value of the pointer is set, a scale range of the dial plate is set, and the like.
Therefore, the user can flexibly modify the attributes of the control elements and see the real effect of the formed user interface control, and therefore, the user can test the control effect in real time in the user interface control generation scheme.
Further, as shown in fig. 5, the apparatus further includes an export module 15, where the export module 15 is configured to export a source code file corresponding to the user interface control according to a source code file export command of a user; and/or exporting the plug-in corresponding to the user interface control according to a plug-in export command of a user.
Therefore, a user can export a source code file or a plug-in corresponding to the user interface control as required, wherein the exported source code, such as source codes in formats of C + +, XML and the like, can be used across platforms, and the exported plug-in can be compatible with QT, namely similar to newly establishing a QT library for QT use, so that the code reuse rate is improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (8)
1. A QT-based user interface control generation method is characterized by comprising the following steps:
when a starting command is received, displaying a control generation interface and a control element list, wherein the control element list displays control elements according to classes; wherein the control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class;
displaying a control element corresponding to the control type in the control element list according to the control type selected by a user on a control generation interface;
displaying a target control element to the control generation interface according to the selection and dragging operation of a user;
combining a plurality of target control elements according to element combination operation of a user to form a user interface control;
exporting a command according to a source code file of a user, and exporting a source code file corresponding to the user interface control; and/or exporting the plug-in corresponding to the user interface control according to a plug-in export command of a user; wherein the exported source code file can be used across platforms, and the exported plug-in is compatible with QT.
2. The method of claim 1, further comprising:
displaying an attribute setting window when a starting command is received, wherein the attribute setting window is a floating window;
the method for combining the multiple target control elements to form the user interface control according to the element combination operation of the user comprises the following steps:
and setting the attributes of the target control elements according to a control attribute command set in the attribute setting window by a user, wherein the attributes comprise a maximum value, a minimum value and a coordinate value.
3. The method of claim 1, wherein displaying a target control element to the control generation interface according to a selection drag operation of a user comprises:
determining the display position of the target control element according to the selection dragging action of the user;
and calling a drawing function through a drawing event function to realize the display of the target control element at the corresponding position.
4. The method of claim 1, wherein the control types comprise background, foreground, pointer, scale, dial, chart, and/or curve.
5. A QT-based user interface control generation device is characterized by comprising a first display module, a selection module, a second display module and a combination module, wherein,
the first display module is used for displaying a control generation interface and a control element list when a starting command is received, wherein the control element list displays control elements according to classes; wherein the control generation interface is constructed based on a QWIdget class, the control element list is constructed based on a QTreeWidget class, and the control elements are constructed based on a QcItem class and a Qobject class;
the selection module is used for displaying the control element corresponding to the control type in the control element list according to the control type selected by the user on the control generation interface;
the second display module is used for displaying the target control element to the control generation interface according to the selection and dragging operation of the user;
the combination module is used for combining a plurality of target control elements according to element combination operation of a user to form a user interface control;
the device also comprises an export module, wherein the export module is used for exporting a command according to a source code file of a user and exporting the source code file corresponding to the user interface control; and/or exporting the plug-in corresponding to the user interface control according to a plug-in export command of a user; wherein the exported source code file can be used across platforms, and the exported plug-in is compatible with QT.
6. The apparatus of claim 5, further comprising a third display module, wherein,
the third display module is used for displaying an attribute setting window when a starting command is received, wherein the attribute setting window is a floating window;
and the combination module is used for setting the attributes of each of a plurality of target control elements in the user interface control according to a control attribute setting command set in the attribute setting window by a user, wherein the attributes comprise a maximum value, a minimum value and a coordinate value.
7. The apparatus of claim 5, wherein the second display module comprises a determination unit and a display unit, wherein,
the determining unit is used for determining the display position of the target control element according to the selection dragging action of the user; and the display unit is used for calling a drawing function through a drawing event function to realize the display of the target control element at the corresponding position.
8. The apparatus of claim 5, wherein the control types comprise background, foreground, pointer, scale, dial, chart, and/or curve.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611160188.1A CN108228287B (en) | 2016-12-15 | 2016-12-15 | QT-based user interface control generation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611160188.1A CN108228287B (en) | 2016-12-15 | 2016-12-15 | QT-based user interface control generation method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108228287A CN108228287A (en) | 2018-06-29 |
CN108228287B true CN108228287B (en) | 2021-05-25 |
Family
ID=62651391
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611160188.1A Active CN108228287B (en) | 2016-12-15 | 2016-12-15 | QT-based user interface control generation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108228287B (en) |
Families Citing this family (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109445859B (en) * | 2018-10-09 | 2022-09-16 | 瑞光电气有限公司 | Control method of massage chair hand control board and massage chair hand control board |
CN109582429B (en) * | 2018-12-07 | 2021-08-10 | 上海航天电子通讯设备研究所 | QT platform-based circular P air display condition display method and device |
CN111324348A (en) * | 2018-12-17 | 2020-06-23 | 北京华航无线电测量研究所 | Man-machine interaction interface implementation method of ground control platform of guide equipment |
CN109656557B (en) * | 2018-12-19 | 2022-08-05 | 北京像素软件科技股份有限公司 | User interface generation method and device |
CN111488087B (en) * | 2019-01-25 | 2021-09-07 | 西安诺瓦星云科技股份有限公司 | Control display method, device and system and computer readable storage medium |
CN112230914B (en) * | 2019-07-15 | 2023-09-15 | 腾讯科技(深圳)有限公司 | Method, device, terminal and storage medium for producing small program |
CN110795071A (en) * | 2019-10-11 | 2020-02-14 | 国电南京自动化股份有限公司 | User interface design and code separation method supporting real-time data dynamic binding |
CN111026393A (en) * | 2019-11-19 | 2020-04-17 | 中冶南方(武汉)自动化有限公司 | QT-based SCADA system HMI development method |
CN112256257A (en) * | 2020-10-22 | 2021-01-22 | 杭州萤石软件有限公司 | Interface construction method, readable storage medium and electronic device |
CN112346724A (en) * | 2020-11-03 | 2021-02-09 | 广州朗国电子科技有限公司 | Method for rapidly generating application display interface and storage medium |
CN112988862A (en) * | 2021-02-09 | 2021-06-18 | 中国建设银行股份有限公司 | Configurable data visualization method and device |
CN113656005B (en) * | 2021-06-29 | 2023-11-24 | 杭州华橙软件技术有限公司 | Application component library construction method, application component configuration method and related devices |
CN115080044B (en) * | 2022-07-22 | 2022-11-11 | 浙江中控技术股份有限公司 | Processing method and device of combined assembly, front-end equipment and storage medium |
CN116204165A (en) * | 2023-04-24 | 2023-06-02 | 麒麟软件有限公司 | QT engineering development plug-in and engineering graphical development system and method based on same |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7584465B1 (en) * | 2004-09-20 | 2009-09-01 | The Mathworks, Inc. | Memory mapping for single and multi-processing implementations of code generated from a block diagram model |
CN101739251A (en) * | 2008-11-17 | 2010-06-16 | 康佳集团股份有限公司 | Method and system for generating interface control |
CN102981861A (en) * | 2012-12-12 | 2013-03-20 | 上海航天测控通信研究所 | Using method of custom control based on Qt |
CN104484189B (en) * | 2014-12-31 | 2018-07-10 | 北京拼图科技有限公司 | The structure and design method of a kind of application interface |
CN106162353A (en) * | 2015-03-25 | 2016-11-23 | 中兴通讯股份有限公司 | Interface processing method, Apparatus and system |
CN106202025A (en) * | 2016-07-21 | 2016-12-07 | 深圳艾派网络科技股份有限公司 | A kind of OA workflow list method for customizing |
-
2016
- 2016-12-15 CN CN201611160188.1A patent/CN108228287B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108228287A (en) | 2018-06-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108228287B (en) | QT-based user interface control generation method and device | |
CN105302545B (en) | Method and device for developing custom control of configuration software | |
CN108351764B (en) | Data processing method and system | |
EP2677451B1 (en) | License verification method and apparatus, and computer readable storage medium storing program therefor | |
US10976725B2 (en) | User interface widget modeling and placement | |
US20140047409A1 (en) | Enterprise application development tool | |
US20140232724A1 (en) | Moving visualizations between displays and contexts | |
CN103984626A (en) | Method and device for generating test-case script | |
US9785416B2 (en) | Presenting a custom view in an integrated development environment based on a variable selection | |
CN112445564B (en) | Interface display method, electronic device and computer readable storage medium | |
CN108089858B (en) | Method and device for creating visual interface | |
CN111936966A (en) | Design system for creating graphical content | |
CN104978114A (en) | Method and device for displaying chart | |
US9684738B2 (en) | Text-based command generation | |
US20110131526A1 (en) | Overlay user interface for command confirmation | |
CN107621951B (en) | View level optimization method and device | |
CN109189537A (en) | The dynamic display method of page info calculates equipment and computer storage medium | |
US20140267380A1 (en) | System and method for efficiently viewing a style | |
CN110764762A (en) | Page forming method and device, computer readable storage medium and terminal | |
CN115169294A (en) | Data conversion method, device and medium | |
US20180121044A1 (en) | Run-time event handler generation in json environments | |
US9280323B2 (en) | Display of source code semantic layers | |
US9552347B1 (en) | Data grid cell styling systems and methods | |
CN111240676A (en) | Method and device for generating code of skeleton screen | |
CN103677716A (en) | Disk signature display method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant after: Loongson Zhongke Technology Co.,Ltd. Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant before: LOONGSON TECHNOLOGY Corp.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |