diff options
author | Kai Koehne <kai.koehne@qt.io> | 2018-03-20 15:07:04 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2018-04-23 06:27:40 +0000 |
commit | a69a3594e2c4122aef91c5511d5eeb78b7bfcb5c (patch) | |
tree | b99564d4854109119d4dda36eb9616006a344a9b /src/corelib/doc | |
parent | e555c03a4255bb4109a4b55d38561297ce8a2d2e (diff) |
Doc: Advocate use of std::initializer_list constructor in Q[String]List
We're relying on C++11 since a while, so lets not advertise creating
lists of strings with operator<<() anymore.
Change-Id: I14a3442ff852ac2c106d90c63504eb9ebb737609
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp | 13 | ||||
-rw-r--r-- | src/corelib/doc/snippets/qstringlist/main.cpp | 11 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp index ac17de1bee..27565a7878 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp @@ -54,11 +54,14 @@ QList<QDate> dateList; //! [0] -//! [1] -QList<QString> list; -list << "one" << "two" << "three"; -// list: ["one", "two", "three"] -//! [1] +//! [1a] +QList<QString> list = { "one", "two", "three" }; +//! [1a] + + +//! [1b] +list << "four" << "five"; +//! [1b] //! [2] diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp index 4d9c015747..55c60650fe 100644 --- a/src/corelib/doc/snippets/qstringlist/main.cpp +++ b/src/corelib/doc/snippets/qstringlist/main.cpp @@ -61,10 +61,13 @@ public: Widget::Widget(QWidget *parent) : QWidget(parent) { -//! [0] - QStringList fonts; - fonts << "Arial" << "Helvetica" << "Times" << "Courier"; -//! [0] +//! [0a] + QStringList fonts = { "Arial", "Helvetica", "Times" }; +//! [0a] + +//! [0b] + fonts << "Courier" << "Verdana"; +//! [0b] //! [1] for (int i = 0; i < fonts.size(); ++i) |