diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-07-30 17:36:14 +0200 |
---|---|---|
committer | MÃ¥rten Nordheim <marten.nordheim@qt.io> | 2020-10-06 11:16:36 +0200 |
commit | fa8d021fa6fcb040fb702b6ffd2deee52a3b748a (patch) | |
tree | 15c6a311dcf9e6c64a162ba62d2d9a83846ba159 /examples | |
parent | 40874625f996899ca1e976f0240da697e784c2c6 (diff) |
Convert a couple of APIs to use views
Try to get rid of APIs that use raw 'const {char, QChar} *, length'
pairs. Instead, use QByteArrayView or QStringView.
As QStringConverter is a new class, simply change the API to what we'd like
to have. Also adjust hidden API in QStringBuilder and friends.
Change-Id: I897d47f63a7b965f5574a1e51da64147f9e981f6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/richtext/textedit/textedit.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp index e2d373ceba..194e1e3d92 100644 --- a/examples/widgets/richtext/textedit/textedit.cpp +++ b/examples/widgets/richtext/textedit/textedit.cpp @@ -418,7 +418,7 @@ bool TextEdit::load(const QString &f) QByteArray data = file.readAll(); QMimeDatabase db; if (db.mimeTypeForFileNameAndData(f, data).name() == QLatin1String("text/html")) { - auto encoding = QStringDecoder::encodingForHtml(data.constData(), data.size()); + auto encoding = QStringDecoder::encodingForHtml(data); QString str = QStringDecoder(encoding ? *encoding : QStringDecoder::Utf8)(data); QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename); textEdit->document()->setBaseUrl(baseUrl); |