Doc: QLatin1StringView documentation misses string literals namespace
QLatin1StringView documentation assumes knowledge of string literals namespace. This commit adds a 'using' statement to the code samplles that use string literals. Fixes: QTBUG-135945 Pick-to: 6.8 Change-Id: I17971d343d9dad132394b91d93ac045c2c8d019f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 72becc7c124f27ad1506ed4fc49d9abe1242629b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
8735188f2c
commit
78f9131efe
@ -1,9 +1,9 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
|
using namespace Qt::StringLiterals;
|
||||||
|
// ...
|
||||||
class ZipEngineHandler : public QAbstractFileEngineHandler
|
class ZipEngineHandler : public QAbstractFileEngineHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -12,6 +12,8 @@ if (mime.inherits("text/plain")) {
|
|||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
using namespace Qt::StringLiterals;
|
||||||
|
// ...
|
||||||
QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "mime/packages"_L1,
|
QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "mime/packages"_L1,
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -8,6 +8,8 @@ using namespace Qt::StringLiterals;
|
|||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
using namespace Qt::StringLiterals;
|
||||||
|
// ...
|
||||||
writer.startMap(4); // 4 elements in the map
|
writer.startMap(4); // 4 elements in the map
|
||||||
|
|
||||||
writer.append("label"_L1);
|
writer.append("label"_L1);
|
||||||
@ -73,6 +75,8 @@ using namespace Qt::StringLiterals;
|
|||||||
//! [7]
|
//! [7]
|
||||||
|
|
||||||
//! [8]
|
//! [8]
|
||||||
|
using namespace Qt::StringLiterals;
|
||||||
|
// ...
|
||||||
writer.append("Hello, World"_L1);
|
writer.append("Hello, World"_L1);
|
||||||
//! [8]
|
//! [8]
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
// Required for using the '_L1' string literal.
|
||||||
|
using namespace Qt::StringLiterals;
|
||||||
|
// ...
|
||||||
QString url = "https://www.unicode.org/"_L1;
|
QString url = "https://www.unicode.org/"_L1;
|
||||||
//! [1]
|
//! [1]
|
||||||
|
|
||||||
@ -35,6 +36,9 @@ str.append("Hello ").append("World");
|
|||||||
//! [4bis]
|
//! [4bis]
|
||||||
|
|
||||||
//! [5]
|
//! [5]
|
||||||
|
// Required for using the '_L1' string literal.
|
||||||
|
using namespace Qt::StringLiterals;
|
||||||
|
// ...
|
||||||
if (str == "auto"_L1
|
if (str == "auto"_L1
|
||||||
|| str == "extern"_L1
|
|| str == "extern"_L1
|
||||||
|| str == "static"_L1
|
|| str == "static"_L1
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
//! [0]
|
||||||
|
// Required for using the '_L1' string literal.
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
//! [0]
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
|
// Required for using the '_L1' string literal.
|
||||||
|
using namespace Qt::StringLiterals;
|
||||||
|
// ...
|
||||||
|
|
||||||
QString foo;
|
QString foo;
|
||||||
QString type = "long";
|
QString type = "long";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user