diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-10-31 09:10:10 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2018-11-01 13:08:52 +0000 |
commit | adacda175265b7a6253f619a0742abbf041f945a (patch) | |
tree | 15b503648d820cfe9865d45281b04de9799b9911 | |
parent | 640356be3199823483f8e8764f73e90e7a0f617a (diff) |
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>
-rw-r--r-- | src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc index df0f705262..2de4eb0c18 100644 --- a/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc +++ b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc @@ -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: |