summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-02-25 16:49:05 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2020-02-28 15:37:11 +0100
commitc158f881b30a28ab28ede0df538cbf1af4326c76 (patch)
treedc3501d9f9a9edd6ac74adfc8304fa1d04b85e89 /examples/widgets
parent8de66e1f244ee500b7df79ecbeaa32d889dc7d27 (diff)
Docs: Use Qt::SplitBehavior in preference to QString::SplitBehavior
The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Applied suitable wrapping round various char and string literals, since docs are meant to show best practice. Change-Id: Ie061905fad26f9b4dda3eedba4612704f0a19126 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/draganddrop/draggabletext/dragwidget.cpp2
-rw-r--r--examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp4
-rw-r--r--examples/widgets/graphicsview/flowlayout/window.cpp2
-rw-r--r--examples/widgets/itemviews/chart/mainwindow.cpp2
-rw-r--r--examples/widgets/itemviews/editabletreemodel/treemodel.cpp3
-rw-r--r--examples/widgets/itemviews/simpletreemodel/treemodel.cpp3
-rw-r--r--examples/widgets/tutorials/addressbook/part7/addressbook.cpp2
7 files changed, 10 insertions, 8 deletions
diff --git a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
index 2135ba2ef9..4a430ebf56 100644
--- a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
+++ b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
@@ -113,7 +113,7 @@ void DragWidget::dropEvent(QDropEvent *event)
if (event->mimeData()->hasText()) {
const QMimeData *mime = event->mimeData();
QStringList pieces = mime->text().split(QRegularExpression(QStringLiteral("\\s+")),
- QString::SkipEmptyParts);
+ Qt::SkipEmptyParts);
QPoint position = event->pos();
QPoint hotSpot;
diff --git a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
index 4fbc6d3fd9..a02b1cb42a 100644
--- a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
+++ b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
@@ -163,8 +163,8 @@ void DragWidget::dropEvent(QDropEvent *event)
}
//! [11] //! [12]
} else if (event->mimeData()->hasText()) {
- QStringList pieces = event->mimeData()->text().split(QRegularExpression(QStringLiteral("\\s+")),
- QString::SkipEmptyParts);
+ QStringList pieces = event->mimeData()->text().split(
+ QRegularExpression(QStringLiteral("\\s+")), Qt::SkipEmptyParts);
QPoint position = event->pos();
for (const QString &piece : pieces) {
diff --git a/examples/widgets/graphicsview/flowlayout/window.cpp b/examples/widgets/graphicsview/flowlayout/window.cpp
index 8fe06d0e11..0edaa686b4 100644
--- a/examples/widgets/graphicsview/flowlayout/window.cpp
+++ b/examples/widgets/graphicsview/flowlayout/window.cpp
@@ -59,7 +59,7 @@ Window::Window(QGraphicsItem *parent) : QGraphicsWidget(parent, Qt::Window)
FlowLayout *lay = new FlowLayout;
const QString sentence(QLatin1String("I am not bothered by the fact that I am unknown."
" I am bothered when I do not know others. (Confucius)"));
- const QVector<QStringRef> words = sentence.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
+ const QVector<QStringRef> words = sentence.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
for (const QStringRef &word : words) {
QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
QLabel *label = new QLabel(word.toString());
diff --git a/examples/widgets/itemviews/chart/mainwindow.cpp b/examples/widgets/itemviews/chart/mainwindow.cpp
index 53f57fbb49..671cfb1941 100644
--- a/examples/widgets/itemviews/chart/mainwindow.cpp
+++ b/examples/widgets/itemviews/chart/mainwindow.cpp
@@ -134,7 +134,7 @@ void MainWindow::loadFile(const QString &fileName)
if (!line.isEmpty()) {
model->insertRows(row, 1, QModelIndex());
- const QStringList pieces = line.split(',', QString::SkipEmptyParts);
+ const QStringList pieces = line.split(QLatin1Char(','), Qt::SkipEmptyParts);
if (pieces.size() < 3)
continue;
model->setData(model->index(row, 0, QModelIndex()),
diff --git a/examples/widgets/itemviews/editabletreemodel/treemodel.cpp b/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
index 836c2e8651..9678e45be7 100644
--- a/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
+++ b/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
@@ -267,7 +267,8 @@ void TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
if (!lineData.isEmpty()) {
// Read the column data from the rest of the line.
- const QStringList columnStrings = lineData.split('\t', QString::SkipEmptyParts);
+ const QStringList columnStrings =
+ lineData.split(QLatin1Char('\t'), Qt::SkipEmptyParts);
QVector<QVariant> columnData;
columnData.reserve(columnStrings.size());
for (const QString &columnString : columnStrings)
diff --git a/examples/widgets/itemviews/simpletreemodel/treemodel.cpp b/examples/widgets/itemviews/simpletreemodel/treemodel.cpp
index cfa65846ed..28640d6433 100644
--- a/examples/widgets/itemviews/simpletreemodel/treemodel.cpp
+++ b/examples/widgets/itemviews/simpletreemodel/treemodel.cpp
@@ -194,7 +194,8 @@ void TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
if (!lineData.isEmpty()) {
// Read the column data from the rest of the line.
- const QStringList columnStrings = lineData.split('\t', QString::SkipEmptyParts);
+ const QStringList columnStrings =
+ lineData.split(QLatin1Char('\t'), Qt::SkipEmptyParts);
QVector<QVariant> columnData;
columnData.reserve(columnStrings.count());
for (const QString &columnString : columnStrings)
diff --git a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
index 717d0882af..1ba23756c4 100644
--- a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
+++ b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
@@ -413,7 +413,7 @@ void AddressBook::exportAsVCard()
int index = name.indexOf(" ");
if (index != -1) {
- nameList = name.split(QRegularExpression("\\s+"), QString::SkipEmptyParts);
+ nameList = name.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts);
firstName = nameList.first();
lastName = nameList.last();
} else {