Why are comments that start with “//!” colored blu

2019-07-10 02:35发布

Qt Creator normally colors comments green, but I saw blue colored comments in the Qt Examples, and Qt Creator seems to color every comment that starts with //! in blue.

Here's an example screenshot:

enter image description here

Is this some convention? What does the blue signify?

2条回答
爷、活的狠高调
2楼-- · 2019-07-10 03:00

Comments that begin with //! are the Qt style for code documentation as contrasted with regular comments. See the doxygen manual for details on the structure of it, but basically, these kinds of comments are intended for automatic extraction into documentation about the code.

查看更多
对你真心纯属浪费
3楼-- · 2019-07-10 03:06

It's a Doxygen comment.

There are multiple styles:

Qt block comment:

/*!
... text ...
*/

Qt one-line comment:

//! ... one line of text ...

JavaDoc block comment:

/**
  * ... text ...
*/

JavaDoc one-line comment:

/// ... one line of text ...
查看更多
登录 后发表回答