Skip to content
ShowFL edited this page Sep 21, 2019 · 2 revisions

Application theme

About the theme

Toou2D abandoned the use of Qt control and control2 to redefine dozens of commonly used controls,they are not only easy to use but also come with theme skin binding.Dark mode has become popular with Android and iOS,themes skin styles are very important for an application.

ini file

From baidu baike: https://baike.baidu.com/item/ini文件

Because the INI file rule is simple, Toou2D uses it to configure the topic package.

main.ini

  • Start with main.ini to configure topics that can configure package names, authors, versions, descriptions.
  • List of component theme,these ini are like CSS in Html.
;theme config
[CONFIG]
about       = this is new theme
version     = 1.0
author      = Toou

;list of component theme
[CONTROLS]
TRectangle    = TRectangle.ini
UCustom       = UCustom.ini

Data type

Data type: bool、color 、ini 、double 、string Each data type depends on the type of the Qml component binding property.

;property key=value
color          = blue
bg.color       = #00ff00
border.color   = #f00
border.width   = 2

Specific rules

Support all INI syntax rules,there are also T2D specific rules.

  • [GROUPNAME] It represents a component object or some component object that USES a specific property below the node,to be the same as the component attribute 'theme.groupname'.

  • [GROUPNAME:STATE] The colon is preceded by the component object group name, followed by the component trigger state name,visual effects performed when a component triggers a shape,the same is true for states:[] in QML.

  • . 'dot' lists the child object properties of a skin - bound object. For example: background inside TButton, text on TButton, please refer to the following code snippet.

QML code:
TButton{
    theme.groupName = "NavigationBtn"
    background.color = TColor.random
}
TButton.ini configuration:

[GENERAL]
bg.color         = #2D2D2D

[NavigationBtn]
bg.color         = red

[NavigationBtn:pressed]
bg.color         = blue

Clone this wiki locally