問(wèn)題描述
是什么意思//![n]
(n
= 0, 1, 2 ...) Qt 示例項(xiàng)目中 C++/QML 源代碼中的標(biāo)記?
What is the meaning of the //! [n]
(n
= 0, 1, 2 ...) markup in the C++/QML sources in the Qt sample projects?
例如:
//! [0]
GLWidget::GLWidget(Helper *helper, QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent), helper(helper)
{
elapsed = 0;
setFixedSize(840, 400);
setAutoFillBackground(false);
}
//! [0]
//! [1]
void GLWidget::animate()
{
elapsed = (elapsed + qobject_cast<QTimer*>(sender())->interval()) % 1000;
repaint();
}
//! [1]
//! [2]
void GLWidget::paintEvent(QPaintEvent *event)
{
QPainter painter;
painter.begin(this);
painter.setRenderHint(QPainter::Antialiasing);
helper->paint(&painter, event, elapsed);
painter.end();
}
//! [2]
推薦答案
盡管存在常見(jiàn)的誤解,但這是 qdoc 語(yǔ)法,不是 doxygen.此注釋用于 Qt 項(xiàng)目中的文檔目的,以標(biāo)記要呈現(xiàn)的示例片段.請(qǐng)參閱文檔和對(duì)應(yīng)代碼,實(shí)現(xiàn)了這個(gè)功能.
Despite the common misconception, this is qdoc syntax, not doxygen. This comment is for documentation purposes in the Qt Project to mark example snippets to be rendered so. See the documentation and the corresponding code that implements this feature.
作為 Qt 的最終用戶,您不需要過(guò)多處理它,除非您開(kāi)始為 Qt 項(xiàng)目本身做出貢獻(xiàn),或者您正在嘗試將 qdoc 重用于您自己的項(xiàng)目,這在這一點(diǎn)上無(wú)疑是奇怪的.
As an end user of Qt, you do not need to deal with it too much unless you start contributing to the Qt Project itself or you are trying to reuse qdoc for your own project, which would be admittedly odd at this point.
這篇關(guān)于//![0] 在 Qt 源代碼中的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!