问题
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?
回答1:
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.
回答2:
There used to be example code snippets on the Customizing Qt Quick Controls documentation page, that were automatically extracted from our own QML code with help of those qdoc-markers.
来源:https://stackoverflow.com/questions/40347224/strange-comment-syntax-in-quick-controls-2-0-qml-source