//! [0]在Qt源代码中 [英] //! [0] in Qt source code

查看:2910
本文介绍了//! [0]在Qt源代码中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//的含义是什么?在Qt示例项目的C ++ / QML源中的[n] n = 0,1,2 ...)

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]


推荐答案

strong> qdoc 语法,不是 doxygen。这个注释是为了文档目的在Qt项目中标记要渲染的示例片段。它没有真正记录,但这里你可以找到实现此功能的相应代码。

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. It is not really documented well, but here you can find the corresponding code that implements this feature.

作为Qt的最终用户,您不需要处理太多,除非您开始贡献Qt项目本身,或者你试图重用qdoc为你自己的项目,这是肯定奇怪的在这一点。

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.

这篇关于//! [0]在Qt源代码中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆