Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_text_qstringconverter.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
9
10
12QString string = "...";
16
17
20
22while (new_data_available()) {
23 QByteArray chunk = get_new_data();
24 string += toUtf16(chunk);
25}
27
30
32while (new_data_available()) {
33 QString chunk = get_new_data();
34 encoded += fromUtf16(chunk);
35}
37
38{
42auto data = toUtf16(encodedString); // data's type is QStringDecoder::EncodedData<const QByteArray &>
43QString string = toUtf16(encodedString); // Implicit conversion to QString
44
45// Here you have to cast "data" to QString
46auto func = [&]() { return !toUtf16.hasError() ? QString(data) : u"foo"_s; }
48}
49
50{
52QString string = "...";
54auto data = fromUtf16(string); // data's type is QStringEncoder::DecodedData<const QString &>
55QByteArray encodedString = fromUtf16(string); // Implicit conversion to QByteArray
56
57// Here you have to cast "data" to QByteArray
58auto func = [&]() { return !fromUtf16.hasError() ? QByteArray(data) : "foo"_ba; }
60}
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum func
Definition qopenglext.h:663
QByteArray encodedString
[0]