Search code examples
qtqmlcommentsqtquickcontrols2

Strange //! comment syntax in Quick Controls 2.0 QML source


While looking through Quick Controls 2.0 sources, I came upon a peculiar comment syntax that I can't seem to find in docs:

//! [property]
property: ...
...
//! [property]

for example, pairs of //! [contentItem], //! [background] could be seen in TabButton.qml.


I wonder if this is just a convention chosen by the developers to delimit regions of code, or does it indeed have some special meaning?


Solution

  • With Qt comments that begin with ! are parsed to generate documentation. That applies to single and multi line comments.

    In this particular case however it doesn't seem to contain any actual documentation, it is used to signify the lines where individual implementation details begin and end.

    You can learn more about the documentation format here.