diff --git a/examples/corelib/tools/customtype/message.cpp b/examples/corelib/tools/customtype/message.cpp index e83697cb74..489ec24a4d 100644 --- a/examples/corelib/tools/customtype/message.cpp +++ b/examples/corelib/tools/customtype/message.cpp @@ -61,7 +61,7 @@ Message::Message(const QString &body, const QStringList &headers) QDebug operator<<(QDebug dbg, const Message &message) { const QString body = message.body(); - QVector pieces = body.splitRef("\r\n", QString::SkipEmptyParts); + QVector pieces = body.splitRef(QLatin1String("\r\n"), Qt::SkipEmptyParts); if (pieces.isEmpty()) dbg.nospace() << "Message()"; else if (pieces.size() == 1) diff --git a/examples/sql/masterdetail/dialog.cpp b/examples/sql/masterdetail/dialog.cpp index bb1812eace..3267352b07 100644 --- a/examples/sql/masterdetail/dialog.cpp +++ b/examples/sql/masterdetail/dialog.cpp @@ -86,7 +86,7 @@ void Dialog::submit() int albumId = addNewAlbum(title, artistId); QStringList tracks; - tracks = tracksEditor->text().split(',', QString::SkipEmptyParts); + tracks = tracksEditor->text().split(QLatin1Char(','), Qt::SkipEmptyParts); addTracks(albumId, tracks); increaseAlbumCount(indexOfArtist(artist)); 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 words = sentence.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); + const QVector 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 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 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 { diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index ac7fc7d078..58d68d9375 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -766,7 +766,7 @@ void Widget::splitFunction() //! [60] str = "This time, a normal English sentence."; - list = str.split(QRegExp("\\W+"), QString::SkipEmptyParts); + list = str.split(QRegExp("\\W+"), Qt::SkipEmptyParts); // list: [ "This", "time", "a", "normal", "English", "sentence" ] //! [60] @@ -787,7 +787,7 @@ void Widget::splitFunction() //! [91] str = "This time, a normal English sentence."; - list = str.split(QRegularExpression("\\W+"), QString::SkipEmptyParts); + list = str.split(QRegularExpression("\\W+"), Qt::SkipEmptyParts); // list: [ "This", "time", "a", "normal", "English", "sentence" ] //! [91] @@ -801,24 +801,24 @@ void Widget::splitFunction() void Widget::splitCaseSensitiveFunction() { //! [62] - QString str = "a,,b,c"; + QString str = QStringLiteral("a,,b,c"); - QStringList list1 = str.split(','); + QStringList list1 = str.split(QLatin1Char(',')); // list1: [ "a", "", "b", "c" ] - QStringList list2 = str.split(',', QString::SkipEmptyParts); + QStringList list2 = str.split(QLatin1Char(','), Qt::SkipEmptyParts); // list2: [ "a", "b", "c" ] //! [62] //! [62-empty] QString str = "abc"; - auto parts = str.split(""); + auto parts = str.split(QString()); // parts: {"", "a", "b", "c", ""} //! [62-empty] //! [62-slashes] QString str = "/a/b/c/"; - auto parts = str.split('/'); + auto parts = str.split(QLatin1Char('/')); // parts: {"", "a", "b", "c", ""} //! [62-slashes] } diff --git a/src/widgets/doc/snippets/dockwidgets/mainwindow.cpp b/src/widgets/doc/snippets/dockwidgets/mainwindow.cpp index 53f91589bf..95dae667a8 100644 --- a/src/widgets/doc/snippets/dockwidgets/mainwindow.cpp +++ b/src/widgets/doc/snippets/dockwidgets/mainwindow.cpp @@ -79,7 +79,7 @@ void MainWindow::setupContents() do { QString line = titlesFile.readLine().trimmed(); - QStringList parts = line.split("\t", QString::SkipEmptyParts); + QStringList parts = line.split(QLatin1Char('\t'), Qt::SkipEmptyParts); if (parts.size() != 2) break;