Doc: make QML type naming rules more searchable
It is possible to find the rules via a web search, but it can be made easier by giving the section its own descriptive name. Task-number: QTBUG-71505 Change-Id: Ibbf8768c7570d09b0a4bc3026632730f7e8c1c02 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
640356be31
commit
adacda1752
|
@ -34,7 +34,18 @@ One of the core features of QML is that it enables QML object types to be easily
|
|||
|
||||
\section1 Defining an Object Type with a QML File
|
||||
|
||||
To create an object type, a QML document should be placed into a text file named as \e <TypeName>.qml where \e <TypeName> is the desired name of the type, which must be comprised of alphanumeric characters or underscores and beginning with an uppercase letter. This document is then automatically recognized by the engine as a definition of a QML type. Additionally, a type defined in this manner is automatically made available to other QML files within the same directory as the engine searches within the immediate directory when resolving QML type names.
|
||||
\section2 Naming Custom QML Object Types
|
||||
|
||||
To create an object type, a QML document should be placed into a text file named as \e <TypeName>.qml where \e <TypeName> is the desired name of the type. The type name has the following requirements:
|
||||
|
||||
\list
|
||||
\li It must be comprised of alphanumeric characters or underscores.
|
||||
\li It must begin with an uppercase letter.
|
||||
\endlist
|
||||
|
||||
This document is then automatically recognized by the engine as a definition of a QML type. Additionally, a type defined in this manner is automatically made available to other QML files within the same directory as the engine searches within the immediate directory when resolving QML type names.
|
||||
|
||||
\section2 Custom QML Type Definition
|
||||
|
||||
For example, below is a document that declares a \l Rectangle with a child \l MouseArea. The document has been saved to file named \c SquareButton.qml:
|
||||
|
||||
|
|
Loading…
Reference in New Issue