diff options
author | Martin Smith <martin.smith@qt.io> | 2018-04-20 13:01:27 +0200 |
---|---|---|
committer | Martin Smith <martin.smith@qt.io> | 2018-06-01 16:38:01 +0000 |
commit | e3e0a6d6d6c50dc21439f24728ee3614c5825d36 (patch) | |
tree | 0a96500cd881ade21309a8021651023465d851fd /src/gui/text | |
parent | e1b40675ba4adca014c45926ef29b78d22fe4833 (diff) |
doc: Document Qt namespace in multiple modules
qdoc didn't handle this. This update fixes most of what was wrong,
but tuning the details of the namespace reference pages might follw.
We have namespace Qt as an exaqmple. Most of the elements in the Qt
namespace are in QtCore, but a few functions are declared in QtGui.
Before this update, qdoc used the hack of using #ifdef to remove the
declarations from qtextdocument.h in QtGui and .cpp and then added
them back into qtnamespace.h and .cpp in QtCore.
Now that hack is no longer necessary. The functions in the Qt namespace
that are declared in QtGui are documented there, but the documentation
is linked to from the namespace reference page, which remains in QtCore.
That is, only one \namespace command is used to document the Qt namespace,
and it appears in qnamespace.qdoc where it always did, but the documentation
for the Qt namespace functions declared in QtGui is now appears in
qtextdocument.cpp where it belongs.
Change-Id: Ic5888875c3b8310a3dba244475e2a6c3bc0c1808
Task-number: QTBUG-67267
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 28 | ||||
-rw-r--r-- | src/gui/text/qtextdocument.h | 4 |
2 files changed, 29 insertions, 3 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 129a326ba2..5d8eed409e 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -75,6 +75,18 @@ QT_BEGIN_NAMESPACE Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n); + +/*! + Returns \c true if the string \a text is likely to be rich text; + otherwise returns \c false. + + This function uses a fast and therefore simple heuristic. It + mainly checks whether there is something that looks like a tag + before the first line break. Although the result may be correct + for common cases, there is no guarantee. + + This function is defined in the \c <QTextDocument> header file. +*/ bool Qt::mightBeRichText(const QString& text) { if (text.isEmpty()) @@ -133,6 +145,16 @@ bool Qt::mightBeRichText(const QString& text) return false; } +/*! + Converts the plain text string \a plain to an HTML-formatted + paragraph while preserving most of its look. + + \a mode defines how whitespace is handled. + + This function is defined in the \c <QTextDocument> header file. + + \sa escape(), mightBeRichText() +*/ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode) { int col = 0; @@ -181,6 +203,12 @@ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode) return rich; } +/*! + \fn QTextCodec *Qt::codecForHtml(const QByteArray &ba) + \internal + + This function is defined in the \c <QTextDocument> header file. +*/ #ifndef QT_NO_TEXTCODEC QTextCodec *Qt::codecForHtml(const QByteArray &ba) { diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 64e39d4648..33c0b48683 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -70,17 +70,15 @@ class QTextCursor; template<typename T> class QVector; -#ifndef Q_CLANG_QDOC namespace Qt { Q_GUI_EXPORT bool mightBeRichText(const QString&); Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre); -#ifndef QT_NO_TEXTCODEC +#if !defined(QT_NO_TEXTCODEC) || defined(Q_CLANG_QDOC) Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba); #endif } -#endif class Q_GUI_EXPORT QAbstractUndoItem { |