Theme skin switching method, device, computer equipment and storage medium

By loading theme skin packages with attribute binding mechanism and switching instructions, dynamically switching theme skins in the interface, the problem of high cost of theme style switching in the existing technology is solved, and efficient theme skin switching is achieved.

CN118535272BActive Publication Date: 2024-11-12ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411005238.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-11-12
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

In the prior art, it is necessary to re-modify the code and compile and install it to realize the switching of theme styles, resulting in the cost of adding new styles.

Method used

By loading the theme skin package with attribute binding mechanism, generating switching instructions in response to user operations, adjusting the theme skin package according to the instructions and attribute binding mechanism, dynamically switch the theme skin in the interface, and using the switching instructions and attribute binding mechanism to achieve the theme skin dynamic switching.

Benefits of technology

The cost of switching theme skins is reduced. The theme skins only need to be instantiated once, which improves switching efficiency and avoids the process of repeated modification and compilation and installation of codes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535272B_ABST
    Figure CN118535272B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, computer equipment and storage medium for switching theme skins, wherein the method includes: loading a theme skin package with an attribute binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles; in response to the theme skin style in the user operation interface, a switching instruction for the theme skin style is generated; according to the switching instruction and the attribute binding mechanism, the theme skin package is adjusted to generate skin information of the target theme skin; based on the skin information of the target theme skin, the theme skin in the interface is switched to the target theme skin. Through the present application, the problem of excessively high cost of adding new styles in the related art is solved, and the dynamic switching of the newly added style of the theme skin is realized by using the switching instruction and the attribute binding mechanism, and the theme skin only needs to be instantiated once, which reduces the cost of switching the theme skin.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device, computer equipment and storage medium for switching theme skins. Background Art

[0002] With the rapid development of the Internet of Things, wearable devices, and smart homes, the importance of graphical interfaces or graphical user interfaces (GUIs) in these fields will continue to increase. The descriptive scripting language (Qt Meta-Object Language, QML) controls are easy to learn, powerful, and cross-platform compatible, making it one of the preferred languages ​​for GUI development in these fields.

[0003] The default theme styles provided by QML controls are: Basic Style, Fusion Style, Imagine Style, macOS Style, iOS Style, Material Style, Universal Style, and Windows Style. However, the default theme styles often cannot meet customer needs. The current theme skin switching solution is: by creating a style file QML, pre-configure the required theme (such as light and dark mode), and switch the theme value during program operation, thereby controlling the color attribute value changes of each control under different themes, affecting the interface display. The disadvantage of this solution is that it is necessary to re-modify the code and compile and install it to implement the switching of the new theme style, resulting in excessively high costs for adding new styles.

[0004] There is a problem in the related art that the code needs to be modified and compiled and installed to achieve the switching of the new theme style, which leads to excessively high cost of adding the new style. At present, no effective solution has been proposed. Summary of the invention

[0005] In this embodiment, a theme skin switching method, apparatus, computer equipment and storage medium are provided to solve the problem in the related art that the code needs to be modified and compiled and installed to realize the switching of new theme styles, resulting in excessively high costs for adding new styles.

[0006] In a first aspect, a method for switching a theme skin is provided in this embodiment, including:

[0007] Loading a theme skin package with a property binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles;

[0008] In response to the theme skin style in the user operation interface, generating a switching instruction of the theme skin style;

[0009] According to the switching instruction and the attribute binding mechanism, the theme skin package is adjusted to generate skin information of the target theme skin;

[0010] Based on the skin information of the target theme skin, the theme skin in the interface is switched to the target theme skin.

[0011] In some of the embodiments, the theme skin package includes a theme skin name, a thumbnail, a general style, and a basic component style;

[0012] The dynamic library plug-in and / or static library plug-in of the basic component style utilizes C++ language and QML to reconstruct the styles of the basic components of all the QML controls.

[0013] In some embodiments, the method further comprises:

[0014] Before loading a theme skin package with an attribute binding mechanism, corresponding function instructions are generated in response to function keys in a user operation interface; the function instructions include skin switching instructions, skin importing instructions, and skin creating instructions.

[0015] In some embodiments, the method further comprises:

[0016] When the functional instruction is a skin creation instruction, the theme skin package is set based on an attribute binding mechanism;

[0017] Or, based on the attribute binding mechanism, the built-in theme skin is adjusted to obtain the theme skin package.

[0018] In some of the embodiments, loading a preset theme skin package includes:

[0019] When the function instruction is a skin import instruction, parsing the theme skin package, and copying the parsed theme skin package to a program directory at the same level as the built-in theme skin;

[0020] Set the theme skin style in the theme skin package.

[0021] In some embodiments, the method further comprises:

[0022] Determine whether the theme skin package is valid;

[0023] If the theme skin package is valid, the loading of the theme skin package is completed;

[0024] If the theme skin package is invalid, the built-in theme skin of the QML control is used.

[0025] In some of the embodiments, adjusting the theme skin package according to the switching instruction and the attribute binding mechanism to generate skin information of the target theme skin includes:

[0026] According to the switching instruction and the attribute binding mechanism, the common style and / or basic component style in the theme skin package is adjusted to obtain theme skin data in a singleton form;

[0027] Based on the theme skin data, skin information of a target theme skin is generated.

[0028] In a second aspect, a theme skin switching device is provided in this embodiment, including: a loading module, a response module, a processing module and a switching module;

[0029] The loading module is used to load a theme skin package with a property binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles;

[0030] The response module is used to generate a switching instruction of the theme skin style in response to the theme skin style in the user operation interface;

[0031] The processing module is used to adjust the theme skin package according to the switching instruction and the attribute binding mechanism to generate skin information of the target theme skin;

[0032] The switching module is used to switch the theme skin in the interface to the target theme skin based on the skin information of the target theme skin.

[0033] In a third aspect, a computer device is provided in this embodiment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the theme skin switching method described in the first aspect when executing the computer program.

[0034] In a fourth aspect, in this embodiment, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the theme skin switching method described in the first aspect is implemented.

[0035] Compared with the related art, the theme skin switching method, device, computer equipment and storage medium provided in this embodiment load a theme skin package with a property binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles; in response to the theme skin style in the user operation interface, a switching instruction for the theme skin style is generated; according to the switching instruction and the property binding mechanism, the theme skin package is adjusted to generate skin information of the target theme skin; based on the skin information of the target theme skin, the theme skin in the interface is switched to the target theme skin, which solves the problem in the related art that the code needs to be modified and compiled and installed to realize the switching of the newly added theme style, resulting in excessively high cost of the newly added style, and the switching instruction and the property binding mechanism are used to realize the dynamic switching of the newly added style of the theme skin, and the theme skin only needs to be instantiated once, reducing the cost of theme skin switching.

[0036] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0038] Figure 1 This is a hardware structure block diagram of a terminal device of a theme skin switching method provided by an embodiment of the present application;

[0039] Figure 2 is a flow chart of a method for switching a theme skin provided by an embodiment of the present application;

[0040] Figure 3 This is a diagram showing the relationship between the newly added theme skins and the built-in theme skins;

[0041] Figure 4 It is a schematic diagram of the structure of the theme library;

[0042] Figure 5 This is a schematic diagram of the structure of the theme skin package;

[0043] Figure 6 is a flowchart of step S230;

[0044] Figure 7 is a flow chart of a method for switching a theme skin provided by a preferred embodiment of the present application;

[0045] Figure 8 It is a structural block diagram of a subject skin switching device provided in one embodiment of the present application.

[0046] In the figure: 102, processor; 104, memory; 106, transmission device; 108, input and output device; 210, loading module; 220, response module; 230, processing module; 240, switching module. DETAILED DESCRIPTION

[0047] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0048] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with general skills in the technical field to which this application belongs. The words "one", "a", "the", "these" and the like in this application do not indicate a quantitative limitation, and they may be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone. Generally, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0049] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 FIG. 1 is a hardware structure diagram of a terminal of the theme skin switching method of this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 and a memory 104 for storing data, wherein the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0050] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the theme skin switching method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0051] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0052] In this embodiment, a method for switching a theme skin is provided. Figure 2 is a flow chart of the theme skin switching method of this embodiment. Figure 2 As shown, the process includes the following steps:

[0053] Step S210, loading a theme skin package with a property binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles;

[0054] Step S220, generating a switching instruction of the theme skin style in response to the theme skin style in the user operation interface;

[0055] Step S230, adjusting the theme skin package according to the switching instruction and the attribute binding mechanism, and generating skin information of the target theme skin;

[0056] Step S240: based on the skin information of the target theme skin, the theme skin in the interface is switched to the target theme skin.

[0057] Specifically, the theme skin package can be pre-set, which has a property binding mechanism. After loading it, the newly added theme skin in the theme skin package can be used, and the newly added theme skin is at the same level as the built-in theme skin of the QML control. Figure 3 As shown in the figure, the newly added theme skin and the built-in theme skin have theme skin styles, which can be directly presented in the interface, so that users can directly operate the theme skin style in the interface. In the figure, under the skin style, the basic style, fusion style, etc. are all styles of the built-in theme skin; the custom skin style is the style of the newly added theme skin, which is at the same level as the style of the built-in theme skin, and it includes different themes, each theme includes buttons, labels, texts, etc. Each button, label, and text also has different text colors, background colors, background colors when pressed, etc.

[0058] Among them, the attribute binding mechanism refers to the binding of the skin attribute value in the theme skin package with the switching instruction; when the user operates the theme skin style in the interface, it will respond to the operation and generate a switching instruction for the theme skin style. And each time the theme skin style is operated, the skin information in the theme skin package is assigned according to the switching instruction and attribute binding mechanism corresponding to the operated theme skin style, so as to obtain the skin information of the target theme skin. For example: in the interface, the current theme skin style is the gray theme, and the target theme skin style is the black theme. As long as the user selects the black theme, the corresponding switching instruction will be generated, and the relevant slot function will be entered to change the attribute value of the skin information in the theme skin package from gray to black to obtain the skin information of the target theme skin.

[0059] Among them, the process of switching the theme skin in the interface to the target theme skin is: refresh the interface, draw the target theme skin according to the skin information of the target theme skin, so that in the overall implementation process of the theme skin, it only needs to be instantiated once to complete the dynamic switching of the theme skin, thereby improving the efficiency of theme skin switching and reducing the cost of theme skin switching.

[0060] In the related art, the theme skin switching scheme is: by creating a style file QML, pre-configuring the required theme (such as light mode, dark mode), switching the theme value during program operation, thereby controlling the color attribute value changes of each control under different themes, affecting the interface display. The disadvantage of this scheme is that the code needs to be re-modified and compiled and installed to realize the switching of the newly added theme style, resulting in too high a cost for the newly added style. In this embodiment, by loading a theme skin package with a property binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have a theme skin style; in response to the theme skin style in the user operation interface, a switching instruction for the theme skin style is generated; according to the switching instruction and the property binding mechanism, the theme skin package is adjusted to generate the skin information of the target theme skin; based on the skin information of the target theme skin, the theme skin in the interface is switched to the target theme skin, which solves the problem that the code needs to be re-modified and compiled and installed in the related art to realize the switching of the newly added theme style, resulting in too high a cost for the newly added style, and the dynamic switching of the newly added style of the theme skin is realized by using the switching instruction and the property binding mechanism, and the theme skin only needs to be instantiated once, reducing the cost of the theme skin switching.

[0061] The above steps are described in detail below:

[0062] In some of the embodiments, the theme skin package includes a theme skin name, a thumbnail, a common style, and a basic component style;

[0063] The dynamic library plug-in and / or static library plug-in of the basic component style uses C++ language and QML to reconstruct the style of the basic components of all QML controls.

[0064] Specifically, a theme skin package refers to a collection of skin style related images and attribute values ​​in a theme, which can be considered as a theme library such as Figure 4 As shown in the figure, it can be migrated to different projects. As long as the theme library is imported and the theme skin package is applied, the style can be switched (by calling setSkin or directly setting the property value), as well as the custom theme skin package generated by the theme skin package generation tool. The structure of the theme skin package is as follows Figure 5 As shown in the figure, it includes theme skin name, thumbnail, general style and basic component style. Skin name is used to visually display the type of skin; thumbnail is used to visually display the effect of the skin; general style is used for universal colors, not limited to a certain control; basic component style includes button style, label style, check box style, etc., which are used to specifically refer to the style of a certain control / component (such as Button, Label), including color attributes of various states and parts and image resources, etc.

[0065] Among them, the theme skin package includes the theme skin data corresponding to each newly added theme skin; the theme skin data can be considered as a singleton QML file. By setting the skin properties, the slot function is triggered when the skin properties change, and then the properties used by controls such as textColor are modified to manage the newly added theme skin. Then each theme skin data also includes the theme skin name, thumbnail, common style and basic component style. Among them, the common style refers to the format shared by each theme skin, which can directly adopt the common style of the built-in theme skin. Among them, there are two types of basic component styles, namely dynamic library plug-ins and static library plug-ins. Among them, both dynamic library plug-ins and static library plug-ins can use C++ language and QML to reconstruct the style of the basic components of all QML controls. The dynamic library plug-in and the static library plug-in are only different in CMakeList configuration. Both dynamic library plug-ins and static library plug-ins can be used under Windows, Android and Mac, but only static library plug-ins can be used under IOS.

[0066] The following takes the generation of a static library plug-in as an example. After executing cmake, it will automatically generate qmlCustomStylePlugin_CustomStylePlugin.cpp, and then compile it through QtCmake to generate a static library plug-in. The components are reused to reduce code duplication.

[0067] / / CmakeList.txt

[0068] qt_add_library(qmlCustomStyle STATIC) / / SHARED dynamic library, STATIC static library

[0069] #Skip

[0070] qt_add_qml_module(qmlCustomStyle

[0071] OUTPUT_DIRECTORY.. / .. / imports / QtQuick / Controls / CustomStyle#The generated dynamic library or static library will be in this path

[0072] URI module uri when QtQuick.Controls.CustomStyle#import

[0073] VERSION 1.0#Version

[0074] QML_FILES ${qml_files}#qml control file list

[0075] SOURCES ${source_files}#cpp h-style file list )

[0077] #Skip.

[0078] This embodiment is implemented by using a mixed development of C language and QML, wherein C language implements the theme style logic processing part to simplify the parsing of theme skin packages and the generation of style information, including the theme skin package of the static library plug-in; QML implements the theme effect display to be compatible with the built-in theme skin. The technology of using C++ mixed with Qml development improves processing efficiency through C++ and reduces the time consumption of reading local theme skin packages; and while enriching the style, it reduces performance overhead and time consumption.

[0079] In some of the embodiments, the method for switching the theme skin further includes the following steps:

[0080] Before loading a theme skin package with an attribute binding mechanism, corresponding function instructions are generated in response to function keys in the user operation interface; the function instructions include skin switching instructions, skin importing instructions, and skin creating instructions.

[0081] Specifically, there are multiple function buttons in the interface, and different function buttons correspond to different functions and will generate different instructions. After operating different function buttons, it will jump to the corresponding process interface. For example: for the skin switching function button, the user clicks the skin switching function button, which will generate a skin switching instruction; and adjust to the relevant interface for switching the theme skin to complete the theme skin switching. For the skin creation function button, the user clicks the skin creation function button, which will generate a skin creation instruction; adjust the theme skin package tool operation interface to complete the theme skin creation.

[0082] The key may be a button, a menu, or other forms. The operation includes but is not limited to mouse operation (click, double-click, slide), gesture operation (slide, symbol), and voice operation, etc., and there is no restriction on this.

[0083] Through this embodiment, different function buttons are provided corresponding to the creation, import and switching operations, so as to facilitate the user to operate different functions.

[0084] In some of the embodiments, the method for switching the theme skin further includes the following steps:

[0085] When the function instruction is a skin creation instruction, the theme skin package is set based on the attribute binding mechanism;

[0086] Or, based on the attribute binding mechanism, the built-in theme skin is adjusted to obtain a theme skin package.

[0087] Specifically, when the function instruction is a skin creation instruction, the theme skin package tool operation interface is adjusted to guide the user to operate the theme skin package tool operation interface to create a skin, and obtain a theme skin package with an attribute binding mechanism. Alternatively, import a built-in theme skin, adjust the built-in theme skin, and save it as a new theme skin package to reduce the possibility of errors in the newly added skin style. Finally, save the theme skin package locally.

[0088] The theme skin package generated by the RCC tool in the theme skin package tool is a resource file in RCC format, which can be directly loaded by the Qt QML program. The theme skin package tool is a tool specially developed for the theme, which includes the RCC tool. The RCC tool is a binary resource compiler (Resource Compiler) that comes with Qt. It is used to compile resource files (.qrc) into binary files so that applications can quickly load and use them. In addition, the theme style is opened up for more convenient customization.

[0089] Through this embodiment, the creation of the theme skin package is completed quickly, and the created theme skin package can be directly loaded by the Qt QML program, so that the style separation of the theme skin is completed, and the scalability of the theme skin is improved.

[0090] In some embodiments, loading a preset theme skin package in step S210 includes the following steps:

[0091] Step S211, when the function instruction is a skin import instruction, the theme skin package is parsed, and the parsed theme skin package is copied to the program directory at the same level as the built-in theme skin;

[0092] Step S212, setting the theme skin style in the theme skin package.

[0093] Specifically, since the theme skin package is a resource file in RCC format, the Qt QML program can directly parse the locally saved theme skin package; and copy the parsed theme skin package to the program directory at the same level as the built-in theme skin; when the program starts, the theme skin style in the theme skin package can be directly set for users to choose, without the need for user intervention.

[0094] Through this embodiment, the import of the theme skin package is quickly completed.

[0095] In some of the embodiments, the method for switching the theme skin further includes the following steps:

[0096] Determine whether the theme skin package is valid;

[0097] If the theme skin package is valid, the loading of the theme skin package is completed;

[0098] If the theme skin package is invalid, the QML control's own theme skin is used.

[0099] Specifically, each time the program is started, it will load the preset theme skin package, apply the currently selected skin package, and determine whether the theme skin package is valid; if the theme skin package is valid, the loading of the theme skin package will be completed, and the user can use the newly added theme skins and built-in theme skins in the main skin package; if the theme skin package is invalid, the user can use the built-in theme skin of the QML control.

[0100] Through this embodiment, the effectiveness analysis of the theme skin package is added, and the reliability of use of the newly added theme skin is improved.

[0101] In some of the embodiments, Figure 6 As shown, in step S230, adjusting the theme skin package according to the switching instruction and the attribute binding mechanism to generate skin information of the target theme skin includes the following steps:

[0102] Step S231, adjusting the common style and / or basic component style in the theme skin package according to the switching instruction and the attribute binding mechanism to obtain theme skin data in a singleton form;

[0103] Step S232: Generate skin information of the target theme skin based on the theme skin data.

[0104] Specifically, in the interface for switching theme skins, the theme skins for selection (built-in theme skins and newly added theme skins) are displayed. At this time, the user can select the theme skin style they need. The theme skin style has an attribute binding mechanism for adjusting the theme skin package. In response to the theme skin style in the user operation interface, a switching instruction for the theme skin style is generated, and the relevant slot function is entered; according to the switching instruction and the attribute binding mechanism, the general style and / or basic component style in the theme skin package is adjusted to obtain the theme skin data in a singleton form; based on the theme skin data, the skin information of the target theme skin is generated.

[0105] Among them, all control styles are directly associated with the properties in the theme skin package (Custom Style) to ensure unified style and easy maintenance. The theme skin package exists in the form of a singleton and will contain common styles and basic component styles; among them, the basic component style includes the pop-up window style.

[0106] Each control (Button, Text) will be re-implemented and associated with the theme skin package. When used in QML, it will be consistent with the current theme skin, unless the property values ​​related to the control and skin properties are re-assigned (for example: switching from a black theme to a gray theme). For custom controls, such as CustomButton, implement it as a separate control named CustomButton.qml, associate the property values ​​corresponding to the gray theme with the theme skin package, and use it in other QML files. Instantiate it to avoid the need to associate the corresponding properties of the theme skin package every time it is used, so as to reduce code duplication and achieve direct inheritance of styles.

[0107] The present embodiment is described and illustrated below through preferred embodiments.

[0108] Figure 7 It is a flow chart of the theme skin switching method of this preferred embodiment.

[0109] Step S71, start the program, load the locally imported theme skin package, and apply the theme skin package; determine whether the theme skin package is valid; if the theme skin package is valid, complete the loading of the theme skin package; if the theme skin package is invalid, use the built-in theme skin of the QML control.

[0110] Step S72, in response to the function button in the user operation interface, generating corresponding function instructions; the function instructions include skin switching instructions (jump to step S75), skin import instructions (jump to step S74) and skin creation instructions (jump to step S73);

[0111] Step S73, when the function instruction is a skin creation instruction, adjust the theme skin package tool operation interface, guide the user to operate the theme skin package tool operation interface to create a skin, and obtain a theme skin package with an attribute binding mechanism. Alternatively, import a built-in theme skin, adjust the built-in theme skin, and save it as a new theme skin package. Finally, save the theme skin package locally. Alternatively, based on the attribute binding mechanism, adjust the built-in theme skin to obtain a theme skin package.

[0112] Step S74, when the function instruction is a skin import instruction, parse the theme skin package, and copy the parsed theme skin package to the program directory at the same level as the built-in theme skin; when the program is started, the theme skin style in the theme skin package can be directly set.

[0113] It is important to know that when selecting a newly imported theme skin package, it will also determine whether the theme skin package is valid; if the theme skin package is valid, a signal will be sent to notify all interfaces to change the property value; if the theme skin package is invalid, the built-in theme skin of the QML control will be used.

[0114] Step S75, when the function instruction is a skin switching instruction, at this time, the theme skin style in the operation interface includes the built-in theme skin and the newly added theme skin; in response to the theme skin style in the user operation interface, a switching instruction of the theme skin style is generated; according to the switching instruction and the attribute binding mechanism, the theme skin package is adjusted to generate the skin information of the target theme skin; the interface is refreshed, and the target theme skin is drawn according to the skin information of the target theme skin.

[0115] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0116] In this embodiment, a theme skin switching device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0117] Figure 8 is a structural block diagram of the theme skin switching device of this embodiment, such as Figure 8 As shown, the device includes: a loading module 210, a response module 220, a processing module 230 and a switching module 240;

[0118] The loading module 210 is used to load a theme skin package with a property binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles;

[0119] The response module 220 is used to generate a switching instruction of the theme skin style in response to the theme skin style in the user operation interface;

[0120] The processing module 230 is used to adjust the theme skin package according to the switching instruction and the attribute binding mechanism, and generate skin information of the target theme skin;

[0121] The switching module 240 is used to switch the theme skin in the interface to the target theme skin based on the skin information of the target theme skin.

[0122] Through the above-mentioned device, the problem in the related technology that the code needs to be modified and compiled and installed to realize the switching of new theme styles, resulting in excessively high costs for new styles, is solved. The dynamic switching of new styles of the theme skin is realized by using switching instructions and attribute binding mechanism, and the theme skin only needs to be instantiated once, reducing the cost of switching the theme skin.

[0123] In some of the embodiments, the theme skin package includes a theme skin name, a thumbnail, a common style, and a basic component style;

[0124] The dynamic library plug-in and / or static library plug-in of the basic component style uses C++ language and QML to reconstruct the style of the basic components of all QML controls.

[0125] In some of the embodiments, the theme skin switching device further includes an operation module;

[0126] The operation module is used to generate corresponding function instructions in response to the function keys in the user operation interface before loading the theme skin package with the attribute binding mechanism; the function instructions include skin switching instructions, skin importing instructions and skin creating instructions.

[0127] In some of the embodiments, the theme skin switching device further includes a creation module;

[0128] A creation module is used to set the theme skin package based on the attribute binding mechanism when the function instruction is a skin creation instruction;

[0129] Or, based on the attribute binding mechanism, the built-in theme skin is adjusted to obtain a theme skin package.

[0130] In some of the embodiments, the loading module 210 is further used to parse the theme skin package when the function instruction is a skin import instruction, and copy the parsed theme skin package to the program directory at the same level as the built-in theme skin;

[0131] Set the theme skin style in the theme skin package.

[0132] In some of the embodiments, the theme skin switching device further includes a judgment module;

[0133] A judgment module is used to judge whether the theme skin package is valid;

[0134] If the theme skin package is valid, the loading of the theme skin package is completed;

[0135] If the theme skin package is invalid, the QML control's own theme skin is used.

[0136] In some of the embodiments, the processing module 230 is further used to adjust the common style and / or basic component style in the theme skin package according to the switching instruction and the attribute binding mechanism to obtain the theme skin data in a singleton form;

[0137] Based on the theme skin data, skin information of the target theme skin is generated.

[0138] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0139] In this embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0140] Optionally, the computer device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0141] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0142] S1, load the theme skin package with the property binding mechanism; the newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles;

[0143] S2, generating a switching instruction of the theme skin style in response to the theme skin style in the user operation interface;

[0144] S3, adjusting the theme skin package according to the switching instruction and the attribute binding mechanism, and generating skin information of the target theme skin;

[0145] S4, based on the skin information of the target theme skin, switching the theme skin in the interface to the target theme skin.

[0146] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.

[0147] In addition, in combination with the theme skin switching method provided in the above embodiments, a storage medium can also be provided in this embodiment to implement the theme skin switching method. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the theme skin switching methods in the above embodiments is implemented.

[0148] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.

[0149] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.

[0150] The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various locations in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.

[0151] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.

Claims

1. A method for switching a theme skin, characterized in that: include: Load theme skin packages with attribute binding mechanism; The newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; The newly added theme skin and the built-in theme skin have theme skin styles; the theme skin package includes basic component styles; the dynamic library plug-in and / or static library plug-in of the basic component style uses C++ language and QML to reconstruct the styles of the basic components of all the QML controls; the QML controls are reused in a componentized manner; the C++ language is used for the theme style logic processing part; the QML is used for theme effect display to be compatible with the built-in theme skin; In response to the theme skin style in the user operation interface, generating a switching instruction of the theme skin style; According to the switching instruction and the attribute binding mechanism, the theme skin package is adjusted to generate skin information of the target theme skin; Based on the skin information of the target theme skin, switching the theme skin in the interface to the target theme skin; According to the switching instruction and the attribute binding mechanism, the theme skin package is adjusted to generate skin information of the target theme skin, including: According to the switching instruction and the attribute binding mechanism, the common style and / or basic component style in the theme skin package is adjusted to obtain theme skin data in a singleton form; Based on the theme skin data, skin information of a target theme skin is generated.

2. The method for switching theme skins according to claim 1, characterized in that: The theme skin package also includes a theme skin name, a thumbnail, and a general style.

3. The method for switching theme skins according to claim 1, characterized in that: The method further comprises: Before loading a theme skin package with an attribute binding mechanism, corresponding function instructions are generated in response to function keys in a user operation interface; the function instructions include skin switching instructions, skin importing instructions, and skin creating instructions.

4. The method for switching theme skins according to claim 3, characterized in that: The method further comprises: When the functional instruction is a skin creation instruction, the theme skin package is set based on an attribute binding mechanism; Or, based on the attribute binding mechanism, the built-in theme skin is adjusted to obtain the theme skin package.

5. The method for switching theme skins according to claim 4, characterized in that: Load the preset theme skin package, including: When the function instruction is a skin import instruction, parsing the theme skin package, and copying the parsed theme skin package to a program directory at the same level as the built-in theme skin; Set the theme skin style in the theme skin package.

6. The method for switching theme skins according to claim 5, characterized in that: The method further comprises: Determine whether the theme skin package is valid; If the theme skin package is valid, the loading of the theme skin package is completed; If the theme skin package is invalid, the built-in theme skin of the QML control is used.

7. A theme skin switching device, characterized in that: include: Loading module, response module, processing module and switching module; The loading module is used to load the theme skin package with the attribute binding mechanism; The newly added theme skin in the theme skin package is at the same level as the built-in theme skin of the QML control; the newly added theme skin and the built-in theme skin have theme skin styles; the theme skin package includes basic component styles; the dynamic library plug-in and / or static library plug-in of the basic component style uses C++ language and QML to reconstruct the style of all basic components of the QML control; the QML control is reused in a componentized manner; the C++ language is used for the theme style logic processing part; the QML is used for theme effect display to be compatible with the built-in theme skin; The response module is used to generate a switching instruction of the theme skin style in response to the theme skin style in the user operation interface; The processing module is used to adjust the theme skin package according to the switching instruction and the attribute binding mechanism to generate skin information of the target theme skin; The processing module is further used to adjust the common style and / or basic component style in the theme skin package according to the switching instruction and the attribute binding mechanism to obtain the theme skin data in a singleton form; Based on the theme skin data, generate skin information of a target theme skin; The switching module is used to switch the theme skin in the interface to the target theme skin based on the skin information of the target theme skin.

8. A computer device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the steps of the theme skin switching method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the theme skin switching method according to any one of claims 1 to 6 are implemented.