Development method and system for client

文档序号:168554 发布日期:2021-10-29 浏览:23次 中文

阅读说明:本技术 客户端的开发方法和系统 (Development method and system for client ) 是由 李欣 庞志远 王凯 于 2021-08-03 设计创作,主要内容包括:本发明提供了客户端的开发方法和系统,执行主体为客户端,客户端获取用户的选择操作,根据选择操作启动QT窗口,并创建登录窗口和主窗口,通过浏览器脚本元素加载子模块调用第一接口,使登录窗口与主窗口进行窗口切换,浏览器脚本元素加载子模块根据选择操作获取操作事件,QT组件产生执行事件,浏览器脚本元素加载子模块根据操作事件或执行事件,调用第二接口完成功能或请求业务数据,可以提供更加开放的接口,并且兼顾了C(client)客户端和B(browser)客户端的优点。(The invention provides a development method and a development system of a client, wherein an execution main body is the client, the client acquires the selection operation of a user, a QT window is started according to the selection operation, a login window and a main window are created, a first interface is called through a browser script element loading submodule to enable the login window to be switched with the main window, the browser script element loading submodule acquires an operation event according to the selection operation, a QT component generates an execution event, and the browser script element loading submodule calls a second interface to complete a function or request service data according to the operation event or the execution event, so that a more open interface can be provided, and the advantages of a C (client) client and a B (browser) client are taken into consideration.)

1. The client development method is applied to a client, and the client comprises a QT window, a browser script element loading submodule and a QT component; the method comprises the following steps:

acquiring selection operation of a user, wherein the selection operation comprises click operation;

starting the QT window according to the clicking operation, and creating a login window and a main window;

calling a first interface through the browser script element loading submodule to switch the login window and the main window;

the browser script element loading submodule acquires an operation event according to the selection operation;

the QT component generates execution events;

and the browser script element loading submodule calls a second interface to complete a function or request service data according to the operation event or the execution event.

2. The client development method according to claim 1, wherein the first interface includes a third interface and a fourth interface, and the invoking of the first interface by the browser script element loading submodule causes the login window to perform window switching with the main window, including:

when a login window is displayed, login information input by the user is sent to a server, so that the server verifies the login information to obtain response information;

receiving response information sent by the server, wherein the response information comprises verification passing information and token information;

after the third interface is called by the browser script element loading submodule, the login window is switched to the main window, and the token information is sent to the main window;

and when the selection operation is a logout operation, the browser script element loading submodule calls the fourth interface according to the logout operation and then switches the main window to the login window.

3. The method for developing a client as claimed in claim 2, wherein the method further comprises:

when the login window is switched to the main window, displaying the main window and hiding the login window;

and when the main window is switched to the login window, displaying the login window and hiding the main window.

4. The client-side development method according to claim 1, wherein the selection operation further includes a page loading operation, and the browser script element loading submodule acquires an operation event according to the selection operation, including:

the browser script element loading submodule acquires the operation event according to the page loading operation;

alternatively, the first and second electrodes may be,

and the browser script element loading submodule acquires the operation event according to the clicking operation.

5. The client development method of claim 1, wherein after the QT component generates an execution event, the method further comprises:

the QT component sends the execution event to the browser script element loading sub-module.

6. The development system of the client is characterized by being applied to the client, wherein the client comprises a QT window, a browser script element loading submodule and a QT component; the system comprises:

the selection operation acquisition module is used for acquiring selection operations of a user, wherein the selection operations comprise click operations;

the creation module is used for starting the QT window according to the clicking operation and creating a login window and a main window;

the switching module is used for calling a first interface through the browser script element loading submodule to switch the login window and the main window;

an operation event obtaining module, configured to obtain, by the browser script element loading sub-module, an operation event according to the selection operation;

a generation module for the QT component to generate an execution event;

and the calling module is used for calling the browser script element loading submodule to complete a function or request service data by a second interface according to the operation event or the execution event.

7. The client development system according to claim 6, wherein the first interface includes a third interface and a fourth interface, and the switching module is specifically configured to:

when a login window is displayed, login information input by the user is sent to a server, so that the server verifies the login information to obtain response information;

receiving response information sent by the server, wherein the response information comprises verification passing information and token information;

after the third interface is called by the browser script element loading submodule, the login window is switched to the main window, and the token information is sent to the main window;

and when the selection operation is a logout operation, the browser script element loading submodule calls the fourth interface according to the logout operation and then switches the main window to the login window.

8. The client development system of claim 7, further comprising:

the first display module is used for displaying the main window and hiding the login window when the login window is switched to the main window;

and the second display module is used for displaying the login window and hiding the main window when the main window is switched to the login window.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 5 when executing the computer program.

10. A computer-readable medium having non-volatile program code executable by a processor, wherein the program code causes the processor to perform the method of any of claims 1 to 5.

Technical Field

The invention relates to the technical field of computers, in particular to a development method and a development system for a client.

Background

In IT (Internet Technology) program development, a scenario of a large-scale application is in the form of a server and a client. A server is deployed in a central Computer room to provide core services, and a client is deployed on a PC (Personal Computer) terminal used by a user to provide services for the user. The client side performs data interaction with the server by using a network communication technology, and provides rich human-computer interaction related window interfaces, so that the client side is convenient for users to use.

In the traditional technical system, the client has two modes, namely C (client) and B (browser), and each mode has advantages and disadvantages. The client of C is usually developed by using languages such as C + +, Java and the like, and has the advantage of having the highest authority of the host; the disadvantages are low development efficiency and high maintenance cost. The client side of the browser B usually adopts an html + javascript mode, and the browser has the advantages of rich plug-ins, lower technical threshold, and easy development and maintenance due to continuous optimization of the underlying technology of the browser; the disadvantage is that in view of browser security, it is basically impossible to obtain higher authority to complete functions, such as recording content to local, and this part of content is exactly the core requirement of some applications, such as the function that a conference terminal needs to record a conference to local.

QT is a cross-platform C + + application development framework that provides rich GUI (Graphical User Interface) toolkits to complete Interface work, and rich underlying components to complete related data processing work (such as websocket (full duplex TCP-based communication protocol), sql (structured query language), xml (extensible markup language), jjscript object notation, http (hypertext transfer protocol), udp (User datagram protocol), TCP (transmission control protocol), image (image), nfc (near field communication), bluetooth, open graphics, web graphics library, and so on). However, the system is already a C/S client by using the C + + language and has the characteristics of high development starting point, low development efficiency and high maintenance and debugging cost. However, the QT integrates webengine (chrome google browser kernel), and can display a web page (html + javascript) on a GUI interface window, so that to a certain extent, the authority characteristic of the C/S and the rapid development characteristic of the B/S can be used to complete a specific client function, and the advantages of the B/S and the C/S can be taken to a certain extent.

However, QT only defines basic interactions and does not provide a more open interface, requiring a program development technician to perform secondary encapsulation.

Disclosure of Invention

In view of this, the present invention provides a method and a system for developing a client, which can develop the client through a QT encapsulation architecture, provide a more open interface, and take into account the advantages of a client c (client) and a client b (browser).

In a first aspect, an embodiment of the present invention provides a method for developing a client, where the client includes a QT window, a browser script element loading submodule, and a QT component; the method comprises the following steps:

acquiring selection operation of a user, wherein the selection operation comprises click operation;

starting the QT window according to the clicking operation, and creating a login window and a main window;

calling a first interface through the browser script element loading submodule to switch the login window and the main window;

the browser script element loading submodule acquires an operation event according to the selection operation;

the QT component generates execution events;

and the browser script element loading submodule calls a second interface to complete a function or request service data according to the operation event or the execution event.

Further, the first interface includes a third interface and a fourth interface, and the invoking the first interface by the browser script element loading submodule makes the login window and the main window perform window switching, including:

when a login window is displayed, login information input by the user is sent to a server, so that the server verifies the login information to obtain response information;

receiving response information sent by the server, wherein the response information comprises verification passing information and token information;

after the third interface is called by the browser script element loading submodule, the login window is switched to the main window, and the token information is sent to the main window;

and when the selection operation is a logout operation, the browser script element loading submodule calls the fourth interface according to the logout operation and then switches the main window to the login window.

Further, the method further comprises:

when the login window is switched to the main window, displaying the main window and hiding the login window;

and when the main window is switched to the login window, displaying the login window and hiding the main window.

Further, the selecting operation further includes a page loading operation, and the obtaining, by the browser script element loading submodule, an operation event according to the selecting operation includes:

the browser script element loading submodule acquires the operation event according to the page loading operation;

alternatively, the first and second electrodes may be,

and the browser script element loading submodule acquires the operation event according to the clicking operation.

Further, after the QT component generates an execution event, the method further comprises:

the QT component sends the execution event to the browser script element loading sub-module.

In a second aspect, an embodiment of the present invention provides a development system of a client, where the client includes a QT window, a browser script element loading submodule, and a QT component; the system comprises:

the selection operation acquisition module is used for acquiring selection operations of a user, wherein the selection operations comprise click operations;

the creation module is used for starting the QT window according to the clicking operation and creating a login window and a main window;

the switching module is used for calling a first interface through the browser script element loading submodule to switch the login window and the main window;

an operation event obtaining module, configured to obtain, by the browser script element loading sub-module, an operation event according to the selection operation;

a generation module for the QT component to generate an execution event;

and the calling module is used for calling the browser script element loading submodule to complete a function or request service data by a second interface according to the operation event or the execution event.

Further, the first interface includes a third interface and a fourth interface, and the switching module is specifically configured to:

when a login window is displayed, login information input by the user is sent to a server, so that the server verifies the login information to obtain response information;

receiving response information sent by the server, wherein the response information comprises verification passing information and token information;

after the third interface is called by the browser script element loading submodule, the login window is switched to the main window, and the token information is sent to the main window;

and when the selection operation is a logout operation, the browser script element loading submodule calls the fourth interface according to the logout operation and then switches the main window to the login window.

Further, the system further comprises:

the first display module is used for displaying the main window and hiding the login window when the login window is switched to the main window;

and the second display module is used for displaying the login window and hiding the main window when the main window is switched to the login window.

In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, where the memory stores a computer program operable on the processor, and the processor implements the method described above when executing the computer program.

In a fourth aspect, embodiments of the invention provide a computer readable medium having non-volatile program code executable by a processor, the program code causing the processor to perform the method as described above.

The embodiment of the invention provides a method and a system for developing a client, which comprise the following steps: acquiring selection operation of a user, wherein the selection operation comprises click operation; starting the QT window according to the clicking operation, and creating a login window and a main window; calling a first interface through the browser script element loading submodule to switch the login window and the main window; the browser script element loading submodule acquires an operation event according to the selection operation; the QT component generates execution events; the browser script element loading submodule calls a second interface to complete a function or request service data according to the operation event or the execution event, so that a more open interface can be provided, and the advantages of a client C (client) and a client B (browser) are taken into account.

Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.

Fig. 1 is a flowchart of a method for developing a client according to an embodiment of the present invention;

FIG. 2 is a diagram illustrating a QT package architecture according to an embodiment of the present invention;

fig. 3 is a signaling diagram of a switching process between a login window and a main window according to a second embodiment of the present invention;

FIG. 4 is a signaling diagram of an interaction process between a browser script element loading submodule and a QT component according to a third embodiment of the present invention;

fig. 5 is a schematic diagram of a development system of a client according to a fourth embodiment of the present invention.

Icon:

1-selecting an operation acquisition module; 2-a creation module; 3-a switching module; 4-operating an event acquisition module; 5-a generation module; 6-calling the module.

Detailed Description

To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. 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.

In a C/S (Client/Server) development architecture, a Client is developed using languages such as C + +, Java, VB, and C #, which belong to a strong type language, and a dedicated tool is required for compiling, running, and debugging of the language, and a developed program is also directly run on a host computer, and may have all rights of the entire machine, and the language itself supports a wide range of ways to obtain data, such as tcp (transmission control protocol) and udp (user data protocol), application layer protocol (real time streaming protocol), and rtmp (real time messaging protocol), other components and protocols soap (simple object access protocol), and rpc (remote procedure call, etc.). The called resource is also a resource of a comparative bottom layer, such as a hardware resource that can control a cpu (central processing unit), a memory, a video card, and a usb (universal serial bus). The above languages are developed with low efficiency.

In a B/S (Browser/Server) development framework, a Browser is developed by using html + javascript technology, under the technical system, frameworks such as vue and requirejs, a bottom layer module (jquery) and a component framework (element ui) are born, and a client in the B/S development framework is easy to develop by relying on the strong support of the Browser. But when situations such as calling a driver and calling usb resources are met, the situations can not be realized; the security mechanism of the browser is limited, and when a disk needs to be read and written, a specific network protocol (except http and https, which are supported by the browser) is used for receiving and sending data, a com component of a specific system completes specific work, a system process is started, and the like, the situation can be realized.

QT is a cross-platform C + + application development framework, can use the authority characteristics of C/S and the rapid development characteristics of B/S to complete specific client functions, and can take the advantages of B/S and C/S to a certain extent.

However, QT only defines basic interactions and does not provide a more open interface, requiring a program development technician to perform secondary encapsulation.

The method can realize the development separation to a certain extent, namely B/S development and C/S development are naturally isolated, parallel development work can be carried out, the development efficiency is further improved, the development time is shortened, a series of interaction standards are stipulated, independent iteration can be naturally carried out, namely, the bottom layer of a Qt component, only bottom layer disposal is carried out under the condition of technical optimization, an interface part is not changed, technical evolution and version management are easier, various types of components can be expanded through the extension of documents, a component resource library can be formed, when the components are accumulated to a certain number, a multiplexing effect can be generated, namely, the function of one component is used in a plurality of product clients, the accumulation effect of the components is further generated, the reusability of development is improved, and the development workload is further reduced.

For the understanding of the present embodiment, the following detailed description will be given of the embodiment of the present invention.

The first embodiment is as follows:

the present invention divides the architecture of the QT package into multiple levels, including: the QT browser comprises a QT window, a browser script element loading sub-module and a QT component, and also comprises a QT browser function sub-module;

wherein, the QT window: providing an outer window for the entrance of the whole program, wherein the whole functional framework of the outer window is provided by a QT, and a QT browser functional submodule is a sub-display Widget (Widget) of the QT window;

browser script element load submodule (JS & Dom): in order to realize specific functions for a program developer, the whole function of a specific page code loaded by the QWERENGINEEView depends on the specific developed functions and the specific work of the developer;

QT components (QT components): the method is a series of functional modules which are realized by using C + + codes and are based on the invention, and the functional modules can provide specific functions and can be used by JS & Dom according to the relevant standards of the invention;

QT browser function sub-module (QWebEngineView): a function module, which is QT, is carried as a window (as a display window of Chrome kernel browser) and a channel (as data transfer). The entire functional framework of which is provided by QT.

Fig. 1 is a flowchart of a method for developing a client according to an embodiment of the present invention.

Referring to fig. 1, the execution main body is a client, and the client comprises a QT window, a browser script element loading sub-module, a QT browser function sub-module and a QT component; the method comprises the following steps:

step S101, obtaining selection operation of a user, wherein the selection operation comprises click operation;

step S102, starting a QT window according to a click operation, and creating a login window and a main window;

step S103, calling a first interface through a browser script element loading submodule to enable a login window and a main window to be switched;

the login window is used for displaying a login page, the main window is used for displaying a main body function, the first interface is an interface which can be called by JS & Dom, and when the login window is switched to the main window, the main window is displayed and the login window is hidden; when the main window is switched to the login window, displaying the login window and hiding the main window;

step S104, the browser script element loading submodule acquires an operation event according to the selection operation;

specifically, the operation event includes an event called automatically by the kernel, such as loading completion, and a window event, such as a mouse click event, a keyboard event, and a gamepad event.

Step S105, the QT component generates an execution event;

here, after the QT component generates an execution event, the execution event is sent to the browser script element loading sub-module. Wherein the execution event is a notification.

And step S106, the browser script element loading submodule calls a second interface to complete a function or request service data according to the operation event or the execution event.

FIG. 2 is a schematic diagram of a QT package architecture according to an embodiment of the invention.

Referring to fig. 2, with the QT routine initiated as a framework, the framework forms a solid invariant part; QT components and JS & Dom are developed into two branch lines, and respective development and function evolution are respectively carried out; the QWebEngineView is used as a bridge to communicate QT components and JS & Dom and communicate data interaction between B/S and C/S; defining the use standard and the data transmission standard of QT components and JS & Dom by taking a custom json protocol as a communication standard; taking JS & Dom as a management core of a client, managing QT components, Server interaction and interface display;

specifically, the QT window is an entry point of the program, and when a user clicks, the QT window is started, and two qwebengineviews are created: a QWebEngineView is used for processing a login problem, namely a login window; the other QWebEngineView is used for displaying a main body function, namely a main window; the QWebEngineView loads corresponding JS & Dom according to the global configuration file, wherein the configuration form of the JS & Dom is an entry of html (hyper text markup language), htm (hyper text markup language), asp (active server pages), php (hyper text preprocessor) and the like, and the entry can be a local resource file (a webpage which can be opened by a browser stored in the local) or a remote resource file (a webpage which can be opened by a browser stored in the remote server); and the JS & Dom carries out creation, control and destruction operations on the QT components according to the JS codes, and meanwhile, the QT components actively feed back relevant information to the JS & Dom when working, so that the JS & Dom reports and feeds back the information to the user.

When the QT window exits, then the entire program will release QBeebEngineView and all QT components.

The embodiment of the invention provides a development method of a client, wherein an execution main body is the client, the client acquires the selection operation of a user, a QT window is started according to the selection operation, a login window and a main window are created, a first interface is called through a browser script element loading submodule to enable the login window and the main window to be switched, the browser script element loading submodule acquires an operation event according to the selection operation, a QT component generates an execution event, the browser script element loading submodule calls a second interface to complete a function or request service data according to the operation event or the execution event, a more open interface can be provided, and the advantages of a client C (client) and a client B (browser) are taken into consideration.

Example two:

fig. 3 is a signaling diagram of a switching process between a login window and a main window according to a second embodiment of the present invention.

Referring to fig. 3, the execution subject is a client, and the method includes the following steps:

step S201, when a login window is displayed, login information input by a user is sent to a server, so that the server verifies the login information to obtain response information;

here, the login information includes the user name, password, authentication code and other relevant login elements;

step S202, receiving response information sent by the server, wherein the response information comprises verification passing information and token information;

here, token information is a unique user identity identifier;

step S203, after calling a third interface through the browser script element loading submodule, switching the login window to the main window, and sending token information to the main window;

here, the third interface is a slotLoginSuccess interface, the main functions of the main window all need to be displayed on the page, if the page needs to be jumped, the related pages need to be integrated into the same page (the related technologies such as java script module loader and vue are easy to achieve) for uniformly interacting with QT to complete the related functions;

step S204, when the selection operation is a logout operation, the browser script element loading submodule calls a fourth interface according to the logout operation and then switches the main window to the login window;

here, the fourth interface is a slotllout interface. When a QT program is started, a login window and a main window are created, the login window is displayed by default, the main window is hidden, and message circulation is started; when a user logs in, a login window page is loaded through configuration, the JS & Dom authentication is passed, a third interface is called, the authentication is confirmed to be successful, the main window is automatically jumped to, and meanwhile, the login window is hidden; when the user logs out, clicking the main window to log out, calling the fourth interface, displaying the login window after the calling is successful, and hiding the main window;

in particular, the display of the login window and the main window of the QT window are integrated into a configuration file that describes the relative display content of the two windows. The basic format is as follows:

the name of the application program is used for being displayed in a window title bar, different programs need to be customized differently, the name change can also influence the global configuration (windows is in a registry, linux and user configuration) name of the QT, and better client management can be performed; baseUnmuxPort private configuration of application specific functions for use by some components; the base MuxPort is the private configuration of the specific function of the application program and is used by partial components; starting the related configuration of the login window; main is the related configuration of the main window; url the url address of the page to which the window loads. The legal format of url is as follows (file suffix is not limited): html-absolute path address, windows is like D \ web \ index. html; html-address of running directory relative to program; http://192.168.1.101/web/index. html — http-based network address; https://192.168.1.102/web/index. html — https-based network address; x horizontal starting position of the window relative to the screen. Valid when mode is normal; y is the vertical starting position of the window relative to the screen. Valid when mode is normal; width is the width of the window. Valid when mode is not full; height: height of the window. Valid when mode is not full; mode is display mode; center display: wherein the width and height are performed according to the configuration, and if greater than the screen resolution, the screen resolution is performed; normal: displaying according to the coordinates: wherein the coordinates are set to 0 by default if the coordinates exceed the screen resolution, and the screen resolution is used if the width and height are greater than the screen resolution; full: full screen display: ignoring the coordinate and width and height parameters, and filling the screen by default; background picture setting, which relates to a technical barrier, when a Qt window needs to float on QWEBIENGINEEView and an OpenGL technology needs to be used for displaying, due to the mechanism problem of a QT platform framework, if a background picture is set for the whole Browser on a JS & Dom layer at the moment, the background picture covers the floating QT window, but the background picture is usually an important requirement of the whole client, so that the background picture is set on a GUI layer of the QT to be displayed without covering the floating window on the QWEBIENGINEEView.

In the embodiment, when the login window is displayed, login information input by a user is sent to the server, so that the server verifies the login information to obtain response information; receiving response information sent by the server, wherein the response information comprises verification passing information and token information; after a third interface is called through a browser script element loading submodule, a login window is switched to a main window, and token information is sent to the main window; and when the selection operation is the logout operation, the browser script element loading submodule calls a fourth interface according to the logout operation and then switches the main window to the login window.

Example three:

fig. 4 is a signaling diagram of an interaction process between a browser script element loading submodule and a QT component according to a third embodiment of the present invention.

Referring to fig. 4, the method includes the steps of:

step S301, the browser script element loading submodule acquires an operation event according to selection operation, wherein the selection operation comprises page loading operation and clicking operation;

here, the browser script element loading submodule acquires an operation event according to page loading operation; or the browser script element loading submodule acquires an operation event according to the click operation; when the QT window interacts with a browser script element loading submodule, using a QT reverse notification, and when the QT window completes functions such as counting the number and the like, calling the QT reverse notification to notify a main window;

step S302, the browser script element loading submodule calls a server interface to send request information to a server;

here, after the browser script element loading submodule sends the request message to the server, the server sends the response message to the browser script element loading submodule. Wherein, the second interface may be a server interface.

Step S303, the browser script element loading submodule creates or controls or destroys the QT component according to the data; the QT component can be a player, a refrigerator and other controllable equipment;

step S304, the QT component generates an execution event;

step S305, the QT component sends an execution event to a browser script element loading submodule;

step S306, the browser script element loading submodule calls a server interface to complete the function or request the service data.

Particularly, QT provides QWebChannel for interaction with QWebEngineView, and the signal slot function (slot) defined in this class can be directly called by encapsulated js (javascript) code; this class provides a signal function (signal) that can directly call the JS & DOM method. Based on a message channel mechanism provided by QT, QBebChannel is inherited, and a batch of global methods are provided for general functional requirements (common functional requirements of a login window and a main window). QWeChannel is specially provided for the login window and the main window, and specific function requirement extension is provided.

Further, based on the above description, three sub-classes of QWebChannel need to be provided: ChannelBase, LoginChannel, MainChannel. The ChannelBase provides a universal function interface; LoginChannel provides the functional interface required for login (i.e. main window and login window); the MainChannel provides a functional interface required by the main window, and the LoginChannel and the MainChannel inherit the ChannelBase, so that the LoginChannel and the MainChannel simultaneously have a general functional interface and respective specific functional interfaces.

Further, ChannelBase provides the main interface as follows:

setting buffer memory, using key value pair as parameter to store data in host memory, the interface provides QT for Browser to use to store some data in memory for transferring data between different windows. When the program is restarted, the stored data disappears;

void slotSetCache(const QString&key,const QString&val);

acquiring cache data, taking out the stored cache data through a main key, and returning the cache data to js for use;

QString slotGetCache(const QString&key);

v/delete the set cached data;

void slotDelCache(const QString&key);

setting configuration data, using key value pairs as parameters to store the data in a host disk, wherein the interface is used for providing QT for a Browser to use so that the Browser can store some data in the disk, and can be used for transferring data among different windows, and when a program is restarted, the stored data does not disappear;

void slotSetConfig(const QString&key,const QString&val);

acquiring configuration data, and calling the interface by JS & DOM to acquire the configuration data;

QString slotGetConfig(const QString&key);

v/for other windows, passing data to the JS & DOM of the main window;

void slotNotifyMain(const QString&msg);

for other windows, pass data to JS & DOM for landing windows

void slotNotifyLogin(const QString&msg);

// probing routes using native ip, remoteAddr format: 192.168.1.100:8080. Returning values to ip addresses used by the machine

QString slotDetectLocalIp(const QString&remoteAddr);

Further, the interface provided by LoginChannel is formulated as follows:

when login authentication is successful, the interface needs to be called, the main window is jumped to, the interface parameter is the query parameter of the url of the main window, and the JS & DOM of the main window can directly acquire and handle the parameter, for example:

//mainUrl:http://192.168.1.100/web/index.html

//queryString:session=123&id=32&name=test

the final address of the access is:

//http://192.168.1.100/web/index.htmlsession=123&id=32&name=test

void slotLoginSuccess(const QString&queryString);

further, the interface provided by MainChannel is formulated as follows:

creating a component according to the parameters and returning a JS & DOMon, wherein the ID of the component is contained; the interface is called by JS & DOM

The meaning of/per component is a C + + function whose input is passed using json parameters, which govern the use of IDs

QString slotCreateComponent(const QString&param);

Controlling the component according to the component ID and returning a control result;

a functional component module for controlling C + +, wherein different components extend different param parameters;

bool slotControlComponent(const QString&id,const QString&param);

destroy the module according to the module ID;

void slotDestroyComponent(const QString&id);

if yes, destroying all created assemblies and displaying a landing page;

void slotLogout();

preparing global resources, such as initialization procedures for drivers, etc., the interface is called by the JS & DOM and only once, called before all components are created;

v/different global resource types, extended using param parameter;

// return value true succeeds, false fails;

bool slotPrepareGlobalResource(const QString&param);

further, the QT reverse notification uses signal, which is defined in the format as follows:

void notifyFromQtToJs(const QString&param);

v/notification of different components, extended with param parameter;

further, an interface corresponding to an extension parameter of the QT interface is a slotCreateComponent of MainChannel, and a parameter of slotcontrol component:

parameters to create component (slotCreateComponent parameter):

component type, extensible string, such as udp, player, file, etc.; the param is an actual parameter, and if the parameter is an array, the array substructure should be defined in the param object;

the create component returns results:

component type, consistent with the incoming corresponding parameters; the id is a component id value, and is used by subsequent control; param is the actual returned parameter data;

parameters of the modification component (param parameter of slotControlComponent):

// type component type; cmd is a component control command which can be expanded according to the actual situation; other parameters are unnecessary parameters, and each component is automatically expanded and realized according to the cmd condition; the return value is of the pool type, i.e. success and failure;

global resource parameter (slotPrepareGlobalResource):

// type component type; param parameters of Global component resources

Parameter for returning notification (param parameter of notifyFromQtToJs)

// type component type; com _ ID, component ID number of occurrence notification event; param the body of the notification, extended by different component types.

Example four:

fig. 5 is a schematic diagram of a development system of a client according to a fourth embodiment of the present invention.

Referring to fig. 5, the execution subject is a client, and the system includes a selection operation obtaining module 1, a creation module 2, a switching module 3, an operation event obtaining module 4, a generation module 5, and a calling module 6.

The selection operation acquisition module 1 is used for acquiring selection operations of a user, wherein the selection operations comprise click operations;

the creation module 2 is used for starting a QT window according to click operation and creating a login window and a main window;

the switching module 3 is used for calling the first interface through the browser script element loading submodule to switch the login window and the main window;

the operation event acquisition module 4 is used for the browser script element loading submodule to acquire an operation event according to the selection operation;

a generation module 5 for the QT component to generate execution events;

and the calling module 6 is used for calling the second interface to complete the function or request the service data according to the operation event or the execution event by the browser script element loading submodule.

Further, the first interface includes a third interface and a fourth interface, and the switching module 3 is specifically configured to:

when a login window is displayed, login information input by a user is sent to a server, so that the server verifies the login information to obtain response information;

receiving response information sent by the server, wherein the response information comprises verification passing information and token information;

after a third interface is called through a browser script element loading submodule, the login window is switched to the main window, and token information is sent to the main window;

and when the selection operation is a logout operation, the browser script element loading submodule calls the fourth interface according to the logout operation and then switches the main window to the login window.

Further, the system further comprises:

a first display module (not shown) for displaying the main window and hiding the login window when the login window is switched to the main window;

and a second display module (not shown) for displaying the login window and hiding the main window when the main window is switched to the login window.

The embodiment of the invention provides a development system of a client, wherein an execution main body is the client, the client acquires the selection operation of a user, a QT window is started according to the selection operation, a login window and a main window are created, a first interface is called through a browser script element loading submodule to enable the login window and the main window to be switched, the browser script element loading submodule acquires an operation event according to the selection operation, a QT component generates an execution event, the browser script element loading submodule calls a second interface to complete a function or request service data according to the operation event or the execution event, a more open interface can be provided, and the advantages of a client C (client) and a client B (browser) are taken into consideration.

The embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and when the processor executes the computer program, the steps of the method for developing a client provided in the foregoing embodiment are implemented.

Embodiments of the present invention further provide a computer-readable medium having non-volatile program codes executable by a processor, where the computer-readable medium stores a computer program, and the computer program is executed by the processor to perform the steps of the method for developing a client according to the above embodiments.

The computer program product provided in the embodiment of the present invention includes a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiment, and specific implementation may refer to the method embodiment, which is not described herein again.

It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.

The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.

Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

21页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于SQM的数据处理方法、装置、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!