Move Qt::codecForHtml() to qtextcodec.*

The method should move out of Qt together with QTextCodec in Qt 6.
Qt 6 will in any case always assume utf8 for 8bit encoded HTML.

Change-Id: I68adbc1f0df7e36a82ef6b434ee3771f23e3b790
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Lars Knoll 2020-04-07 11:20:22 +02:00
parent 26a38db8a2
commit 5f013bc10f
4 changed files with 16 additions and 21 deletions

View File

@ -1275,4 +1275,15 @@ bool QTextDecoder::needsMoreData() const
return state.remainingChars;
}
/*!
\fn QTextCodec *Qt::codecForHtml(const QByteArray &ba)
\internal
This function is defined in the \c <QTextCodec> header file.
*/
QTextCodec *Qt::codecForHtml(const QByteArray &ba)
{
return QTextCodec::codecForHtml(ba);
}
QT_END_NAMESPACE

View File

@ -167,6 +167,11 @@ private:
QTextCodec::ConverterState state;
};
namespace Qt
{
Q_CORE_EXPORT QTextCodec *codecForHtml(const QByteArray &ba);
}
QT_END_NAMESPACE
#endif // QTEXTCODEC_H

View File

@ -51,9 +51,6 @@
#include <qregularexpression.h>
#endif
#include <qvarlengtharray.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h>
#endif
#include <qthread.h>
#include <qcoreapplication.h>
#include <qmetaobject.h>
@ -211,19 +208,6 @@ 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.
*/
#if QT_CONFIG(textcodec)
QTextCodec *Qt::codecForHtml(const QByteArray &ba)
{
return QTextCodec::codecForHtml(ba);
}
#endif
/*!
\class QTextDocument
\reentrant

View File

@ -62,7 +62,6 @@ class QTextObject;
class QTextFormat;
class QTextFrame;
class QTextBlock;
class QTextCodec;
class QVariant;
class QRectF;
class QTextOption;
@ -74,10 +73,6 @@ namespace Qt
{
Q_GUI_EXPORT bool mightBeRichText(const QString&);
Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre);
#if QT_CONFIG(textcodec) || defined(Q_CLANG_QDOC)
Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba);
#endif
}
class Q_GUI_EXPORT QAbstractUndoItem