14
Qt示例項目中C++/QML源代碼中//! [n]
(n
= 0,1,2 ...)標記的含義是什麼?//! Qt源代碼中的[0]
例如:
//! [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]
他們只是評論。 – billz
最有可能的文檔目的。 – chris