CN111831283A - QT-based human-computer interface modularization development method - Google Patents

QT-based human-computer interface modularization development method Download PDF

Info

Publication number
CN111831283A
CN111831283A CN202010705099.0A CN202010705099A CN111831283A CN 111831283 A CN111831283 A CN 111831283A CN 202010705099 A CN202010705099 A CN 202010705099A CN 111831283 A CN111831283 A CN 111831283A
Authority
CN
China
Prior art keywords
interface
file
control
project
configuration file
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.)
Pending
Application number
CN202010705099.0A
Other languages
Chinese (zh)
Inventor
徐朝鹏
杨志天
任维
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Huanrong Photoelectric Technology Co ltd
Original Assignee
Chengdu Huanrong Photoelectric Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Chengdu Huanrong Photoelectric Technology Co ltd filed Critical Chengdu Huanrong Photoelectric Technology Co ltd
Priority to CN202010705099.0A priority Critical patent/CN111831283A/en
Publication of CN111831283A publication Critical patent/CN111831283A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The invention provides a QT-based man-machine interface modularization development method, which is characterized in that a basic control class of a QT is abstractly packaged to obtain a control class with an attribute interface; creating an interface configuration file; using QT to create a project in a mode of not selecting a creation interface option to obtain a first project file; loading a required control class in the first project to obtain a second project file; adding an interface configuration file and a resource file configured in the interface configuration file in the second project file to obtain a third project file; creating a code file in the third project file, and compiling a slot function in the control class corresponding to the signal configured in the interface configuration file to obtain a fourth project file; and compiling and running the fourth project file by using the QT to obtain a required interface, and improving the code reuse rate, reducing the code amount and the code complexity and improving the interface development efficiency by abstracting and packaging the basic control class of the QT and configuring the interface layout information by using the configuration file.

Description

QT-based human-computer interface modularization development method
Technical Field
The invention relates to a QT-based software development technology of a human-computer control interface, in particular to a QT-based human-computer interface modularization development method.
Background
QT is a C + + graphical user interface application development framework developed by the Qt Company. The method has excellent cross-platform characteristics, and a user can deploy on different operating systems and desktops by only once program development. And an object-oriented mechanism, a rich API and a large amount of development documents of the system enable the system to become a mainstream of application software development more and more. In the development of a human-machine interface using QT, the general steps are as follows:
firstly, designing a document according to the details of an interface, and dividing control classes to be realized.
And secondly, coding the control classes to be realized one by one, wherein the coding comprises the position, the size basic information, the display style and the control response interface of the control.
And thirdly, writing corresponding codes for the realized control classes according to the interface design layout requirements, and adding each control to the position of the interface to be displayed.
And fourthly, adding corresponding control response logic codes for the control needing to add the response.
With the increasing complexity of software development nowadays, the software development cycle is shortened more and more, and the functions are increased more and more. If the human-computer interface is developed according to the steps, a great deal of development time is consumed in developing and laying out the control classes. Moreover, software development in the current flow has strong speciality and is not friendly to expansibility, and if other coding personnel who are not the software want to add a certain control under the software for testing, the problem that the operation is difficult is faced.
Disclosure of Invention
The current man-machine control interface has long development time, and is not friendly to expansibility and interface and low in development efficiency. Based on the problems, the invention provides a QT-based human-computer interface modularization development method, which can realize that the human-computer interface layout display can be configured as required in a building block-like manner, and meanwhile, each control class forming the interface has reusability and good expansibility. Therefore, the reuse degree of the software is improved, the development time of the software is shortened, and the development cost of the software is reduced.
The invention is realized by the following technical scheme:
the invention provides a QT-based man-machine interface modularization development method, which comprises the steps of carrying out abstract packaging on a basic control class of a QT to obtain a control class with an attribute interface; creating an interface configuration file; using QT to create a project in a mode of not selecting a creation interface option to obtain a first project file; loading a required control class in the first project to obtain a second project file; adding an interface configuration file and a resource file configured in the interface configuration file in the second project file to obtain a third project file; creating a code file in the third project file, and compiling a slot function in the control class corresponding to the signal configured in the interface configuration file to obtain a fourth project file; and compiling and running the fourth project file by using the QT to obtain a demand interface.
The design principle of the invention is as follows: the basic control classes provided by the QT are abstractly packaged to obtain the control classes with the attribute interfaces and better expansibility, developers can directly load the control classes in later development projects without realizing the basic control classes provided by the QT each time, the attribute information of the controls is configured in an interface configuration file mode, the assignments of the attributes are not required to be respectively encoded in each control class, the developers only need to write corresponding slot function logics, and in the subsequent development, the developers only need to simply modify the configuration files for the development of similar interfaces. By the method, the code amount and the code complexity of human-computer interface development are greatly reduced, and the code reusability and the development efficiency are improved.
Further, in the above scheme, abstract packaging is performed on the basic control class of the QT, and obtaining the control class with the attribute interface specifically includes: the control class consists of a cpp source file and a corresponding h header file; the attribute interface includes: control id (id), control parent id (parentid), control Position (Position), control Size (Size), control text and background Color (Color), control style Shape (Shape), and Signal the control has (Signal).
Further, the creating of the interface configuration file in the above scheme specifically includes: only one main interface layout information is in the interface configuration file; and generating an interface configuration file through visualization software or manual editing, or modifying the corresponding layout of an existing interface configuration file to serve as a new interface configuration file.
Further, in the above scheme, adding the interface configuration file and the resource file configured in the interface configuration file to the second project file to obtain a third project file specifically includes: the interface configuration file comprises a json and/or txt file; the interface resource file includes a.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the invention abstracts and encapsulates the QT basic control class, provides the attribute interfaces corresponding to the controls, can be conveniently used in the subsequent development work of developers, can conveniently perform further expansion, and improves the code reusability and expansibility by a control class modularization method;
2. the invention uses the configuration file to carry out the page layout, reduces the writing amount and the complexity of codes, can conveniently modify the page layout by modifying the configuration file, shortens the development time and reduces the development cost of software.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a schematic flow chart of a QT-based man-machine interface modular development method.
Fig. 2 is a schematic diagram of a method for generating an interface configuration file based on visualization software.
Fig. 3 is a schematic diagram of a method for generating a configuration file by manual editing.
FIG. 4 is a diagram illustrating a packaging composition method of a QT-based control class module.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
Example 1
As shown in FIG. 1, a QT-based man-machine interface modular development method comprises the following steps:
(1) abstract packaging is carried out on the basic control class of the QT to obtain a control class with an attribute interface;
(2) creating an interface configuration file;
(3) using QT to create a project in a mode of not selecting a creation interface option to obtain a first project file;
(4) loading a required control class in the first project to obtain a second project file;
(5) adding the interface configuration file and the resource file into the project file to obtain a third project file;
(6) creating a code file in the third project file, and compiling a slot function in the control class corresponding to the signal configured in the interface configuration file to obtain a fourth project file;
(7) and compiling and running the fourth project file by using the QT to obtain a demand interface.
The design principle of the invention is as follows: the basic control classes provided by the QT are abstractly packaged to obtain the control classes with the attribute interfaces and better expansibility, developers can directly load the control classes in later development projects without realizing the basic control classes provided by the QT each time, the attribute information of the controls is configured in an interface layout configuration file mode, the assignments of the attributes are not required to be respectively encoded in each control class, the developers only need to write corresponding slot function logics, and in the subsequent development, the developers only need to simply modify the configuration files for the development of similar interfaces. By the method, the code amount and the code complexity of human-computer interface development are greatly reduced, and the code reusability and the development efficiency are improved.
Furthermore, in the above scheme, the basic control class of the QT is abstractly encapsulated to obtain a control with an attribute interface
The class specifically comprises: the control class consists of a cpp source file and a corresponding h header file; the attribute interface includes: control id (id), control parent id (parentid), control Position (Position), control Size (Size), control text and background Color (Color), control style Shape (Shape), and Signal the control has (Signal).
Further, the creating of the interface configuration file in the above scheme specifically includes: main interface layout information in interface configuration file
Only one; and generating an interface configuration file through visualization software or manual editing, or modifying the corresponding layout of an existing interface configuration file to serve as a new interface configuration file.
Further, in the above scheme, adding the interface configuration file and the resource file configured in the interface configuration file to the second project file to obtain a third project file specifically includes: the interface configuration file comprises a json and/or txt file; the interface layout resource file comprises a png file and/or a jpg file, and is mainly used for providing a display effect of background textures for the control.
As shown in fig. 2, a schematic diagram of a QT-based control class module packaging composition method is composed of a resource file and a class file, where the resource file includes, but is not limited to, a png format picture and a jpg format picture and a json format file, the picture resource file mainly provides a display effect of a background texture for a control, and the json format file and the txt format file provide initial data content and a display effect for the control. The cpp source file is a C + + type source file, and the source file and the head file can be composed of a plurality of files due to the complexity of the control, so that the function of one control class is realized. Each control class module at least comprises the following attribute interfaces: control ID (ID), control parent window ID (parent ID), control Position (Position), control Size (Size), control text and background Color (Color), control style Shape (Shape), and Signal the control has (Signal).
Example 2
On the basis of the embodiment 1, the creating of the interface configuration file comprises two modes of generating by using visualization software and manually editing. As shown in fig. 3, the method for generating an interface configuration file using visualization software includes two cases: the first method is that the existing interface configuration file is read, then the three steps of main interface layout information modification, sub-interface layout information addition/modification/deletion and control addition/modification/deletion are sequentially carried out, and finally the interface configuration file is generated; the second method is that the interface configuration file is generated by three steps of adding main interface layout information, creating sub-interface layout information and adding a control without reading the existing interface configuration file. As shown in fig. 4, the method for generating an interface configuration file by manual editing comprises the following steps: copying an existing interface configuration file; modifying the layout information of the main interface; adding/modifying/deleting sub-interface layout information; add/modify/delete controls; and generating a configuration file.
Compared with the prior art, the invention has the advantages that:
(1) the method for loading the control class and the configuration file is used for replacing direct code writing, so that the software development speed is improved, and the attribute modification of the control is facilitated.
(2) The method converts software development into module development, and each control module can be reused continuously through adjustment of the configuration file after being developed once. The flexibility and the adaptability of the software are improved, and the development cost is reduced.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (4)

1. A human-computer interface modularization development method based on QT is characterized by comprising the following steps:
abstract packaging is carried out on the basic control class of the QT to obtain a control class with an attribute interface;
creating an interface configuration file;
using QT to create a project in a mode of not selecting a creation interface option to obtain a first project file;
loading a required control class in the first project to obtain a second project file;
adding an interface configuration file and a resource file configured in the interface configuration file in the second project file to obtain a third project file;
creating a code file in the third project file, and compiling a slot function in the control class corresponding to the signal configured in the interface configuration file to obtain a fourth project file;
and compiling and running the fourth project file by using the QT to obtain a demand interface.
2. The QT-based human-computer interface modularization development method of claim 1, wherein the abstract packaging of the basic control class of the QT to obtain the control class with the attribute interface specifically comprises: the control class consists of a cpp source file and a corresponding h header file; the attribute interface includes: control ID, control parent window ID, control position, control size, control text and background color, control style shape, and control owned signal.
3. The QT-based human-machine interface modularization development method of claim 1, wherein the creating of the interface configuration file specifically comprises: only one main interface layout information is in the interface configuration file; and generating an interface configuration file through visualization software or manual editing, or modifying the corresponding layout of an existing interface configuration file to serve as a new interface configuration file.
4. The QT-based human-machine interface modeling development method of claim 1, wherein the interface configuration files include json or txt files; the interface layout resource file includes a.
CN202010705099.0A 2020-07-21 2020-07-21 QT-based human-computer interface modularization development method Pending CN111831283A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010705099.0A CN111831283A (en) 2020-07-21 2020-07-21 QT-based human-computer interface modularization development method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010705099.0A CN111831283A (en) 2020-07-21 2020-07-21 QT-based human-computer interface modularization development method

Publications (1)

Publication Number Publication Date
CN111831283A true CN111831283A (en) 2020-10-27

Family

ID=72924559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010705099.0A Pending CN111831283A (en) 2020-07-21 2020-07-21 QT-based human-computer interface modularization development method

Country Status (1)

Country Link
CN (1) CN111831283A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506500A (en) * 2020-12-03 2021-03-16 武汉蓝星科技股份有限公司 Visual control creating method and device
CN116204165A (en) * 2023-04-24 2023-06-02 麒麟软件有限公司 QT engineering development plug-in and engineering graphical development system and method based on same

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102591659A (en) * 2011-12-28 2012-07-18 中标软件有限公司 Implementation method for widget on main interface of mobile terminal and management method for widget
CN103309665A (en) * 2013-06-05 2013-09-18 昆明能讯科技有限责任公司 Method for realizing embedded type GUI (Graphical User Interface) based on configuration
CN104239044A (en) * 2014-09-05 2014-12-24 北京航天自动控制研究所 Dynamic generation method for graphical user interface
CN106201458A (en) * 2016-06-27 2016-12-07 上海波汇科技股份有限公司 A kind of interface creating method can joined flexibly and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102591659A (en) * 2011-12-28 2012-07-18 中标软件有限公司 Implementation method for widget on main interface of mobile terminal and management method for widget
CN103309665A (en) * 2013-06-05 2013-09-18 昆明能讯科技有限责任公司 Method for realizing embedded type GUI (Graphical User Interface) based on configuration
CN104239044A (en) * 2014-09-05 2014-12-24 北京航天自动控制研究所 Dynamic generation method for graphical user interface
CN106201458A (en) * 2016-06-27 2016-12-07 上海波汇科技股份有限公司 A kind of interface creating method can joined flexibly and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506500A (en) * 2020-12-03 2021-03-16 武汉蓝星科技股份有限公司 Visual control creating method and device
CN112506500B (en) * 2020-12-03 2022-08-23 武汉蓝星科技股份有限公司 Visual control creating method and device
CN116204165A (en) * 2023-04-24 2023-06-02 麒麟软件有限公司 QT engineering development plug-in and engineering graphical development system and method based on same

Similar Documents

Publication Publication Date Title
KR101143095B1 (en) Coordinating animations and media in computer display output
CN102135873B (en) A kind of method and apparatus creating user interface
US10803647B1 (en) Generating animation rigs using scriptable reference modules
US20090128581A1 (en) Custom transition framework for application state transitions
JP2008146665A (en) Menu item display method and device
CN112070871A (en) Cross-platform three-dimensional visualization engine construction system, method, terminal and storage medium
CN104216691A (en) Application creating method and device
CN101196818A (en) Fast graphical developing system
CN111831283A (en) QT-based human-computer interface modularization development method
CN113094042B (en) Browser-based realization and analysis method for custom component of power automation system
CN111625226A (en) Prototype-based human-computer interaction design implementation method and system
CN109471580B (en) Visual 3D courseware editor and courseware editing method
CN116627418B (en) Multi-level form interface visual generation method and device based on recursion algorithm
CN113485708A (en) Sketch-based cross-platform interface development method and system, computer device and medium
KR101709186B1 (en) Interactive multimedia E-book authoring apparatus and method
CN110795067A (en) Demand prototype reusable method
CN115564903A (en) Three-dimensional scene asset data processing method and device, electronic equipment and storage medium
CN112667210A (en) Modularization customizing method and device for geographic information system software
CN111897530B (en) UI system and method based on UE4 platform
JP2008287365A (en) Program generation device, program generation method, program, and recording medium
CN113362477A (en) 3D data acquisition and monitoring control system and scene editing method thereof
CN102630317A (en) Framework, system and method for rapid deployment of interactive applications
CN115495069B (en) Model-driven coal industry software process implementation method, device and equipment
CN111459472B (en) Visual expression method of model elements for MBSE (moving bed library) graphical modeling software
Gallesio et al. Embedding a Scheme interpreter in the Tk toolkit

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