Merge remote-tracking branch 'origin/5.15' into dev

Change-Id: If36d96c0fef3de5ab6503977501c55c62a2ecc97
This commit is contained in:
Qt Forward Merge Bot 2020-03-01 01:00:23 +01:00 committed by Simon Hausmann
commit 63312fe2ec
99 changed files with 541 additions and 239 deletions

View File

@ -705,6 +705,7 @@ qt_feature("dlopen" PRIVATE
)
qt_feature("relocatable" PRIVATE
LABEL "Relocatable"
PURPOSE "Enable the Qt installation to be relocated."
AUTODETECT QT_FEATURE_shared
CONDITION QT_FEATURE_dlopen OR WIN32 OR NOT QT_FEATURE_shared
)

View File

@ -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<QStringRef> pieces = body.splitRef("\r\n", QString::SkipEmptyParts);
QVector<QStringRef> pieces = body.splitRef(QLatin1String("\r\n"), Qt::SkipEmptyParts);
if (pieces.isEmpty())
dbg.nospace() << "Message()";
else if (pieces.size() == 1)

View File

@ -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));

View File

@ -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;

View File

@ -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) {

View File

@ -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());

View File

@ -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()),

View File

@ -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)

View File

@ -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)

View File

@ -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 {

View File

@ -1813,7 +1813,7 @@ static QStringList splitDeps(const QString &indeps, bool lineMode)
{
if (!lineMode)
return indeps.simplified().split(' ');
QStringList deps = indeps.split('\n', QString::SkipEmptyParts);
QStringList deps = indeps.split('\n', Qt::SkipEmptyParts);
#ifdef Q_OS_WIN
for (auto &dep : deps) {
if (dep.endsWith(QLatin1Char('\r')))

View File

@ -312,7 +312,7 @@ void Win32MakefileGenerator::processRcFileVar()
QByteArray rcString;
QTextStream ts(&rcString, QFile::WriteOnly);
QStringList vers = project->first("VERSION").toQString().split(".", QString::SkipEmptyParts);
QStringList vers = project->first("VERSION").toQString().split(".", Qt::SkipEmptyParts);
for (int i = vers.size(); i < 4; i++)
vers += "0";
QString versionString = vers.join('.');

View File

@ -772,7 +772,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
const auto vars = values(map(args.at(0)));
for (const ProString &var : vars) {
// FIXME: this is inconsistent with the "there are no empty strings" dogma.
const auto splits = var.toQStringRef().split(sep, QString::KeepEmptyParts);
const auto splits = var.toQStringRef().split(sep, Qt::KeepEmptyParts);
for (const auto &splt : splits)
ret << ProString(splt).setSource(var);
}
@ -1576,7 +1576,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (args.count() == 1)
return returnBool(isActiveConfig(args.at(0).toQStringRef()));
const auto mutuals = args.at(1).toQStringRef().split(QLatin1Char('|'),
QString::SkipEmptyParts);
Qt::SkipEmptyParts);
const ProStringList &configs = values(statics.strCONFIG);
for (int i = configs.size() - 1; i >= 0; i--) {
@ -1610,7 +1610,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
} else {
const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|'),
QString::SkipEmptyParts);
Qt::SkipEmptyParts);
for (int i = l.size() - 1; i >= 0; i--) {
const ProString &val = l[i];
for (int mut = 0; mut < mutuals.count(); mut++) {

View File

@ -883,7 +883,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
return ReturnTrue;
}
QChar sep = val.at(1);
auto func = val.split(sep, QString::KeepEmptyParts);
auto func = val.split(sep, Qt::KeepEmptyParts);
if (func.count() < 3 || func.count() > 4) {
evalError(fL1S("The s/// function expects 3 or 4 arguments."));
return ReturnTrue;
@ -1022,7 +1022,7 @@ static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pa
QString vcBinDir = vcInstallDir;
if (vcBinDir.endsWith(QLatin1Char('\\')))
vcBinDir.chop(1);
const auto dirs = pathVar.split(QLatin1Char(';'), QString::SkipEmptyParts);
const auto dirs = pathVar.split(QLatin1Char(';'), Qt::SkipEmptyParts);
for (const QString &dir : dirs) {
if (!dir.startsWith(vcBinDir, Qt::CaseInsensitive))
continue;

View File

@ -260,7 +260,7 @@ QStringList QMakeGlobals::splitPathList(const QString &val) const
QStringList ret;
if (!val.isEmpty()) {
QString cwd(QDir::currentPath());
const QStringList vals = val.split(dirlist_sep, QString::SkipEmptyParts);
const QStringList vals = val.split(dirlist_sep, Qt::SkipEmptyParts);
ret.reserve(vals.length());
for (const QString &it : vals)
ret << IoUtils::resolvePath(cwd, it);

View File

@ -44,6 +44,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.concurrent.Semaphore;
import java.io.IOException;
import android.app.Activity;
import android.app.Service;
@ -70,6 +71,7 @@ import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.InputDevice;
import android.database.Cursor;
import java.lang.reflect.Method;
import java.security.KeyStore;
@ -231,6 +233,61 @@ public class QtNative
}
}
public static long getSize(Context context, String contentUrl)
{
Uri uri = getUriWithValidPermission(context, contentUrl, "r");
long size = -1;
if (uri == null) {
Log.e(QtTAG, "getSize(): No permissions to open Uri");
return size;
}
try {
ContentResolver resolver = context.getContentResolver();
Cursor cur = resolver.query(uri, null, null, null, null);
if (cur != null) {
if (cur.moveToFirst())
size = cur.getLong(5); // size column
cur.close();
}
return size;
} catch (IllegalArgumentException e) {
Log.e(QtTAG, "getSize(): Invalid Uri");
return size;
} catch (UnsupportedOperationException e) {
Log.e(QtTAG, "getSize(): Unsupported operation for given Uri");
return size;
}
}
public static boolean checkFileExists(Context context, String contentUrl)
{
Uri uri = getUriWithValidPermission(context, contentUrl, "r");
boolean exists = false;
if (uri == null) {
Log.e(QtTAG, "checkFileExists(): No permissions to open Uri");
return exists;
}
try {
ContentResolver resolver = context.getContentResolver();
Cursor cur = resolver.query(uri, null, null, null, null);
if (cur != null) {
exists = true;
cur.close();
}
return exists;
} catch (IllegalArgumentException e) {
Log.e(QtTAG, "checkFileExists(): Invalid Uri");
return exists;
} catch (UnsupportedOperationException e) {
Log.e(QtTAG, "checkFileExists(): Unsupported operation for given Uri");
return false;
}
}
// this method loads full path libs
public static void loadQtLibraries(final ArrayList<String> libraries)
{

View File

@ -762,7 +762,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]
@ -783,7 +783,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]
@ -797,24 +797,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]
}

View File

@ -867,8 +867,8 @@ QString QDir::relativeFilePath(const QString &fileName) const
#endif
QString result;
QVector<QStringRef> dirElts = dir.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
QVector<QStringRef> fileElts = file.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
QVector<QStringRef> dirElts = dir.splitRef(QLatin1Char('/'), Qt::SkipEmptyParts);
QVector<QStringRef> fileElts = file.splitRef(QLatin1Char('/'), Qt::SkipEmptyParts);
int i = 0;
while (i < dirElts.size() && i < fileElts.size() &&

View File

@ -324,7 +324,7 @@ void QFileSelectorPrivate::updateSelectors()
QLatin1Char pathSep(',');
QStringList envSelectors = QString::fromLatin1(qgetenv("QT_FILE_SELECTORS"))
.split(pathSep, QString::SkipEmptyParts);
.split(pathSep, Qt::SkipEmptyParts);
if (envSelectors.count())
sharedData->staticSelectors << envSelectors;

View File

@ -394,7 +394,7 @@ static QString readLink(const QFileSystemEntry &link)
static bool uncShareExists(const QString &server)
{
// This code assumes the UNC path is always like \\?\UNC\server...
const QVector<QStringRef> parts = server.splitRef(QLatin1Char('\\'), QString::SkipEmptyParts);
const QVector<QStringRef> parts = server.splitRef(QLatin1Char('\\'), Qt::SkipEmptyParts);
if (parts.count() >= 3) {
QStringList shares;
if (QFileSystemEngine::uncListSharesOnServer(QLatin1String("\\\\") + parts.at(2), &shares))

View File

@ -101,7 +101,7 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
FINDEX_SEARCH_OPS(searchOps), 0, dwAdditionalFlags);
if (findFileHandle == INVALID_HANDLE_VALUE) {
if (nativePath.startsWith(QLatin1String("\\\\?\\UNC\\"))) {
const QVector<QStringRef> parts = nativePath.splitRef(QLatin1Char('\\'), QString::SkipEmptyParts);
const QVector<QStringRef> parts = nativePath.splitRef(QLatin1Char('\\'), Qt::SkipEmptyParts);
if (parts.count() == 4 && QFileSystemEngine::uncListSharesOnServer(
QLatin1String("\\\\") + parts.at(2), &uncShares)) {
if (uncShares.isEmpty())

View File

@ -2239,7 +2239,7 @@ void QProcessPrivate::start(QIODevice::OpenMode mode)
Tokens with spaces can be surrounded by double quotes; three
consecutive double quotes represent the quote character itself.
*/
QStringList QProcess::splitCommand(const QString &command)
QStringList QProcess::splitCommand(QStringView command)
{
QStringList args;
QString tmp;

View File

@ -282,7 +282,7 @@ public:
static QString nullDevice();
static QStringList splitCommand(const QString &command);
static QStringList splitCommand(QStringView command);
public Q_SLOTS:
void terminate();

View File

@ -646,7 +646,7 @@ IApplicationDataContainer *QWinRTSettingsPrivate::getContainer(IApplicationDataC
IApplicationDataContainer *current = parent;
if (group.isEmpty())
return current;
const QStringList groupPath = group.split(QLatin1Char('/'), QString::SkipEmptyParts);
const QStringList groupPath = group.split(QLatin1Char('/'), Qt::SkipEmptyParts);
for (const QString &subGroup : groupPath) {
ComPtr<IApplicationDataContainer> sub = subContainer(current, subGroup);

View File

@ -512,7 +512,8 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
}
// Remove trailing slashes, which occur on Windows.
const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(QDir::listSeparator(), QString::SkipEmptyParts);
const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(
QDir::listSeparator(), Qt::SkipEmptyParts);
searchPaths.reserve(rawPaths.size());
for (const QString &rawPath : rawPaths) {
QString cleanPath = QDir::cleanPath(rawPath);

View File

@ -283,7 +283,7 @@ static QStringList xdgDataDirs()
dirs.append(QString::fromLatin1("/usr/local/share"));
dirs.append(QString::fromLatin1("/usr/share"));
} else {
const auto parts = xdgDataDirsEnv.splitRef(QLatin1Char(':'), QString::SkipEmptyParts);
const auto parts = xdgDataDirsEnv.splitRef(QLatin1Char(':'), Qt::SkipEmptyParts);
// Normalize paths, skip relative paths
for (const QStringRef &dir : parts) {

View File

@ -2693,7 +2693,7 @@ QStringList QCoreApplication::libraryPathsLocked()
auto setPathsFromEnv = [&](QString libPathEnv) {
if (!libPathEnv.isEmpty()) {
QStringList paths = libPathEnv.split(QDir::listSeparator(), QString::SkipEmptyParts);
QStringList paths = libPathEnv.split(QDir::listSeparator(), Qt::SkipEmptyParts);
for (QStringList::const_iterator it = paths.constBegin(); it != paths.constEnd(); ++it) {
QString canonicalPath = QDir(*it).canonicalPath();
if (!canonicalPath.isEmpty()

View File

@ -718,7 +718,7 @@ QMetaType &QMetaType::operator=(const QMetaType &other)
\relates QMetaType
\overload
Returns \c true if the QMetaType \a a represents a difference type
Returns \c true if the QMetaType \a a represents a different type
than the QMetaType \a b, otherwise returns \c false.
*/
@ -1750,7 +1750,7 @@ static QtPrivate::QMetaTypeInterface *interfaceForType(int typeId)
Constructs a QMetaType object that contains all information about type \a typeId.
\note: The default parameter was added in Qt 5.15
\note The default parameter was added in Qt 5.15.
*/
QMetaType::QMetaType(int typeId) : QMetaType(interfaceForType(typeId)) {}

View File

@ -109,7 +109,7 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect
if (!onlySystemDirectory) {
const QString PATH(QLatin1String(qgetenv("PATH").constData()));
searchOrder << PATH.split(QLatin1Char(';'), QString::SkipEmptyParts);
searchOrder << PATH.split(QLatin1Char(';'), Qt::SkipEmptyParts);
}
QString fileName = QString::fromWCharArray(libraryName);
fileName.append(QLatin1String(".dll"));

View File

@ -239,6 +239,8 @@ QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other)
#if QT_CONFIG(binaryjson) && QT_DEPRECATED_SINCE(5, 15)
/*!
\deprecated
Creates a QJsonDocument that uses the first \a size bytes from
\a data. It assumes \a data contains a binary encoded JSON document.
The created document does not take ownership of \a data. The data is
@ -253,7 +255,7 @@ QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other)
Returns a QJsonDocument representing the data.
\deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
\note Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
compatibility. It is undocumented and restrictive in the maximum size of JSON
documents that can be encoded. Qt JSON types can be converted to Qt CBOR types,
which can in turn be serialized into the CBOR binary format and vice versa. The
@ -285,13 +287,15 @@ QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidat
}
/*!
\deprecated
Returns the raw binary representation of the data
\a size will contain the size of the returned data.
This method is useful to e.g. stream the JSON document
in its binary form to a file.
\deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
\note Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
compatibility. It is undocumented and restrictive in the maximum size of JSON
documents that can be encoded. Qt JSON types can be converted to Qt CBOR types,
which can in turn be serialized into the CBOR binary format and vice versa. The
@ -325,13 +329,14 @@ const char *QJsonDocument::rawData(int *size) const
}
/*!
\deprecated
Creates a QJsonDocument from \a data.
\a validation decides whether the data is checked for validity before being used.
By default the data is validated. If the \a data is not valid, the method returns
a null document.
\deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
\note Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
compatibility. It is undocumented and restrictive in the maximum size of JSON
documents that can be encoded. Qt JSON types can be converted to Qt CBOR types,
which can in turn be serialized into the CBOR binary format and vice versa. The
@ -364,6 +369,7 @@ QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidati
}
/*!
\deprecated
Returns a binary representation of the document.
The binary representation is also the native format used internally in Qt,
@ -373,7 +379,7 @@ QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidati
or computers. fromBinaryData() can be used to convert it back into a
JSON document.
\deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
\note Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards
compatibility. It is undocumented and restrictive in the maximum size of JSON
documents that can be encoded. Qt JSON types can be converted to Qt CBOR types,
which can in turn be serialized into the CBOR binary format and vice versa. The

View File

@ -4969,7 +4969,7 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
\snippet code/src_corelib_tools_qbytearray.cpp 44ter
In alternative, it is possible to access the conversion status
Alternatively, it is possible to access the conversion status
and the decoded data directly:
\snippet code/src_corelib_tools_qbytearray.cpp 44quater

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2018 Intel Corporation.
** Copyright (C) 2019 Mail.ru Group.
** Contact: https://www.qt.io/licensing/
@ -1757,6 +1757,9 @@ const QString::Null QString::null = { };
/*!
\enum QString::SplitBehavior
\obsolete
Use Qt::SplitBehavior instead.
This enum specifies how the split() function should behave with
respect to empty strings.
@ -4612,7 +4615,7 @@ int QString::count(const QRegularExpression &re) const
QString QString::section(const QString &sep, int start, int end, SectionFlags flags) const
{
const QVector<QStringRef> sections = splitRef(sep, KeepEmptyParts,
const QVector<QStringRef> sections = splitRef(sep, Qt::KeepEmptyParts,
(flags & SectionCaseInsensitiveSeps) ? Qt::CaseInsensitive : Qt::CaseSensitive);
const int sectionsSize = sections.size();
if (!(flags & SectionSkipEmpty)) {
@ -7603,23 +7606,30 @@ QString QString::number(double n, char f, int prec)
namespace {
template<class ResultList, class StringSource>
static ResultList splitString(const StringSource &source, const QChar *sep,
QString::SplitBehavior behavior, Qt::CaseSensitivity cs, const int separatorSize)
Qt::SplitBehavior behavior, Qt::CaseSensitivity cs, const int separatorSize)
{
ResultList list;
typename StringSource::size_type start = 0;
typename StringSource::size_type end;
typename StringSource::size_type extra = 0;
while ((end = QtPrivate::findString(QStringView(source.constData(), source.size()), start + extra, QStringView(sep, separatorSize), cs)) != -1) {
if (start != end || behavior == QString::KeepEmptyParts)
if (start != end || behavior == Qt::KeepEmptyParts)
list.append(source.mid(start, end - start));
start = end + separatorSize;
extra = (separatorSize == 0 ? 1 : 0);
}
if (start != source.size() || behavior == QString::KeepEmptyParts)
if (start != source.size() || behavior == Qt::KeepEmptyParts)
list.append(source.mid(start, -1));
return list;
}
#if QT_DEPRECATED_SINCE(5, 15)
Qt::SplitBehavior mapSplitBehavior(QString::SplitBehavior sb)
{
return sb & QString::SkipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts;
}
#endif
} // namespace
/*!
@ -7649,12 +7659,25 @@ static ResultList splitString(const StringSource &source, const QChar *sep,
\snippet qstring/main.cpp 62-slashes
\sa QStringList::join(), section()
\since 5.14
*/
QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QStringList QString::split(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return splitString<QStringList>(*this, sep.constData(), behavior, cs, sep.size());
}
#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\obsolete
*/
QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return split(sep, mapSplitBehavior(behavior), cs);
}
#endif
/*!
Splits the string into substring references wherever \a sep occurs, and
returns the list of those strings.
@ -7665,29 +7688,68 @@ QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseS
\note All references are valid as long this string is alive. Destroying this
string will cause all references to be dangling pointers.
\since 5.4
\since 5.14
\sa QStringRef split()
*/
QVector<QStringRef> QString::splitRef(const QString &sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs) const
{
return splitString<QVector<QStringRef>>(QStringRef(this), sep.constData(), behavior,
cs, sep.size());
}
#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\obsolete
\since 5.4
*/
QVector<QStringRef> QString::splitRef(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return splitString<QVector<QStringRef> >(QStringRef(this), sep.constData(), behavior, cs, sep.size());
return splitRef(sep, mapSplitBehavior(behavior), cs);
}
#endif
/*!
\overload
\since 5.14
*/
QStringList QString::split(QChar sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QStringList QString::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return splitString<QStringList>(*this, &sep, behavior, cs, 1);
}
#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\obsolete
*/
QStringList QString::split(QChar sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return split(sep, mapSplitBehavior(behavior), cs);
}
#endif
/*!
\overload
\since 5.14
*/
QVector<QStringRef> QString::splitRef(QChar sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs) const
{
return splitString<QVector<QStringRef> >(QStringRef(this), &sep, behavior, cs, 1);
}
#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\since 5.4
*/
QVector<QStringRef> QString::splitRef(QChar sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return splitString<QVector<QStringRef> >(QStringRef(this), &sep, behavior, cs, 1);
return splitRef(sep, mapSplitBehavior(behavior), cs);
}
#endif
/*!
Splits the string into substrings references wherever \a sep occurs, and
@ -7699,26 +7761,50 @@ QVector<QStringRef> QString::splitRef(QChar sep, SplitBehavior behavior, Qt::Cas
\note All references are valid as long this string is alive. Destroying this
string will cause all references to be dangling pointers.
\since 5.4
\since 5.14
*/
QVector<QStringRef> QStringRef::split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const
QVector<QStringRef> QStringRef::split(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return splitString<QVector<QStringRef> >(*this, sep.constData(), behavior, cs, sep.size());
}
#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\since 5.4
\obsolete
*/
QVector<QStringRef> QStringRef::split(QChar sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const
QVector<QStringRef> QStringRef::split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return split(sep, mapSplitBehavior(behavior), cs);
}
#endif
/*!
\overload
\since 5.14
*/
QVector<QStringRef> QStringRef::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return splitString<QVector<QStringRef> >(*this, &sep, behavior, cs, 1);
}
#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\since 5.4
\obsolete
*/
QVector<QStringRef> QStringRef::split(QChar sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{
return split(sep, mapSplitBehavior(behavior), cs);
}
#endif
#ifndef QT_NO_REGEXP
namespace {
template<class ResultList, typename MidMethod>
static ResultList splitString(const QString &source, MidMethod mid, const QRegExp &rx, QString::SplitBehavior behavior)
static ResultList splitString(const QString &source, MidMethod mid, const QRegExp &rx, Qt::SplitBehavior behavior)
{
QRegExp rx2(rx);
ResultList list;
@ -7727,12 +7813,12 @@ static ResultList splitString(const QString &source, MidMethod mid, const QRegEx
int end;
while ((end = rx2.indexIn(source, start + extra)) != -1) {
int matchedLen = rx2.matchedLength();
if (start != end || behavior == QString::KeepEmptyParts)
if (start != end || behavior == Qt::KeepEmptyParts)
list.append((source.*mid)(start, end - start));
start = end + matchedLen;
extra = (matchedLen == 0) ? 1 : 0;
}
if (start != source.size() || behavior == QString::KeepEmptyParts)
if (start != source.size() || behavior == Qt::KeepEmptyParts)
list.append((source.*mid)(start, -1));
return list;
}
@ -7740,6 +7826,7 @@ static ResultList splitString(const QString &source, MidMethod mid, const QRegEx
/*!
\overload
\since 5.14
Splits the string into substrings wherever the regular expression
\a rx matches, and returns the list of those strings. If \a rx
@ -7764,14 +7851,25 @@ static ResultList splitString(const QString &source, MidMethod mid, const QRegEx
\sa QStringList::join(), section()
*/
QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const
QStringList QString::split(const QRegExp &rx, Qt::SplitBehavior behavior) const
{
return splitString<QStringList>(*this, &QString::mid, rx, behavior);
}
# if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\since 5.4
\obsolete
*/
QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const
{
return split(rx, mapSplitBehavior(behavior));
}
# endif
/*!
\overload
\since 5.14
Splits the string into substring references wherever the regular expression
\a rx matches, and returns the list of those strings. If \a rx
@ -7783,17 +7881,29 @@ QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const
\sa QStringRef split()
*/
QVector<QStringRef> QString::splitRef(const QRegExp &rx, SplitBehavior behavior) const
QVector<QStringRef> QString::splitRef(const QRegExp &rx, Qt::SplitBehavior behavior) const
{
return splitString<QVector<QStringRef> >(*this, &QString::midRef, rx, behavior);
}
#endif
# if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\since 5.4
\obsolete
*/
QVector<QStringRef> QString::splitRef(const QRegExp &rx, SplitBehavior behavior) const
{
return splitRef(rx, mapSplitBehavior(behavior));
}
# endif
#endif // QT_NO_REGEXP
#if QT_CONFIG(regularexpression)
namespace {
template<class ResultList, typename MidMethod>
static ResultList splitString(const QString &source, MidMethod mid, const QRegularExpression &re,
QString::SplitBehavior behavior)
Qt::SplitBehavior behavior)
{
ResultList list;
if (!re.isValid()) {
@ -7807,12 +7917,12 @@ static ResultList splitString(const QString &source, MidMethod mid, const QRegul
while (iterator.hasNext()) {
QRegularExpressionMatch match = iterator.next();
end = match.capturedStart();
if (start != end || behavior == QString::KeepEmptyParts)
if (start != end || behavior == Qt::KeepEmptyParts)
list.append((source.*mid)(start, end - start));
start = match.capturedEnd();
}
if (start != source.size() || behavior == QString::KeepEmptyParts)
if (start != source.size() || behavior == Qt::KeepEmptyParts)
list.append((source.*mid)(start, -1));
return list;
@ -7821,7 +7931,7 @@ static ResultList splitString(const QString &source, MidMethod mid, const QRegul
/*!
\overload
\since 5.0
\since 5.14
Splits the string into substrings wherever the regular expression
\a re matches, and returns the list of those strings. If \a re
@ -7846,14 +7956,26 @@ static ResultList splitString(const QString &source, MidMethod mid, const QRegul
\sa QStringList::join(), section()
*/
QStringList QString::split(const QRegularExpression &re, SplitBehavior behavior) const
QStringList QString::split(const QRegularExpression &re, Qt::SplitBehavior behavior) const
{
return splitString<QStringList>(*this, &QString::mid, re, behavior);
}
# if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\since 5.4
\since 5.0
\obsolete
*/
QStringList QString::split(const QRegularExpression &re, SplitBehavior behavior) const
{
return split(re, mapSplitBehavior(behavior));
}
# endif
/*!
\overload
\since 5.14
Splits the string into substring references wherever the regular expression
\a re matches, and returns the list of those strings. If \a re
@ -7865,10 +7987,22 @@ QStringList QString::split(const QRegularExpression &re, SplitBehavior behavior)
\sa split() QStringRef
*/
QVector<QStringRef> QString::splitRef(const QRegularExpression &re, SplitBehavior behavior) const
QVector<QStringRef> QString::splitRef(const QRegularExpression &re, Qt::SplitBehavior behavior) const
{
return splitString<QVector<QStringRef> >(*this, &QString::midRef, re, behavior);
}
# if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
\since 5.4
\obsolete
*/
QVector<QStringRef> QString::splitRef(const QRegularExpression &re, SplitBehavior behavior) const
{
return splitRef(re, mapSplitBehavior(behavior));
}
# endif
#endif // QT_CONFIG(regularexpression)
/*!

View File

@ -580,45 +580,68 @@ public:
{ return replace(re, QString()); }
#endif
enum SplitBehavior { KeepEmptyParts, SkipEmptyParts };
#if QT_DEPRECATED_SINCE(5, 15)
enum SplitBehavior // ### Qt 6: replace with Qt:: version
{
KeepEmptyParts Q_DECL_ENUMERATOR_DEPRECATED,
SkipEmptyParts Q_DECL_ENUMERATOR_DEPRECATED
};
Q_REQUIRED_RESULT QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QStringList split(QChar sep, SplitBehavior behavior = KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(QChar sep, SplitBehavior behavior = KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QStringList split(const QString &sep, SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QVector<QStringRef> splitRef(const QString &sep, SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QStringList split(QChar sep, SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QVector<QStringRef> splitRef(QChar sep, SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#ifndef QT_NO_REGEXP
Q_REQUIRED_RESULT QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QStringList split(const QRegExp &sep, SplitBehavior behavior) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QVector<QStringRef> splitRef(const QRegExp &sep, SplitBehavior behavior) const;
#endif
#if QT_CONFIG(regularexpression)
Q_REQUIRED_RESULT QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QStringList split(const QRegularExpression &sep, SplitBehavior behavior) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QVector<QStringRef> splitRef(const QRegularExpression &sep, SplitBehavior behavior) const;
#endif
#endif // 5.15 deprecations
private:
static Q_DECL_CONSTEXPR SplitBehavior _sb(Qt::SplitBehavior sb) Q_DECL_NOTHROW
{ return sb & Qt::SkipEmptyParts ? SkipEmptyParts : KeepEmptyParts; }
public:
Q_REQUIRED_RESULT inline QStringList split(const QString &sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT inline QVector<QStringRef> splitRef(const QString &sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT inline QStringList split(QChar sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT inline QVector<QStringRef> splitRef(QChar sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QStringList split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> splitRef(const QString &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QStringList split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> splitRef(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#ifndef QT_NO_REGEXP
Q_REQUIRED_RESULT inline QStringList split(const QRegExp &sep, Qt::SplitBehavior behavior) const;
Q_REQUIRED_RESULT inline QVector<QStringRef> splitRef(const QRegExp &sep, Qt::SplitBehavior behavior) const;
Q_REQUIRED_RESULT
QStringList split(const QRegExp &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const;
Q_REQUIRED_RESULT
QVector<QStringRef> splitRef(const QRegExp &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const;
#endif
#ifndef QT_NO_REGULAREXPRESSION
Q_REQUIRED_RESULT inline QStringList split(const QRegularExpression &sep, Qt::SplitBehavior behavior) const;
Q_REQUIRED_RESULT inline QVector<QStringRef> splitRef(const QRegularExpression &sep, Qt::SplitBehavior behavior) const;
Q_REQUIRED_RESULT
QStringList split(const QRegularExpression &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const;
Q_REQUIRED_RESULT
QVector<QStringRef> splitRef(const QRegularExpression &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const;
#endif
@ -1485,15 +1508,21 @@ public:
int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QVector<QStringRef> split(const QString &sep, QString::SplitBehavior behavior = QString::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QVector<QStringRef> split(QChar sep, QString::SplitBehavior behavior = QString::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#if QT_DEPRECATED_SINCE(5, 15)
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QVector<QStringRef> split(const QString &sep, QString::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead")
QVector<QStringRef> split(QChar sep, QString::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#endif // 5.15 deprecations
Q_REQUIRED_RESULT inline QVector<QStringRef> split(const QString &sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT inline QVector<QStringRef> split(QChar sep, Qt::SplitBehavior behavior,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QStringRef left(int n) const;
Q_REQUIRED_RESULT QStringRef right(int n) const;

View File

@ -384,23 +384,6 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons
#endif // QT_CONFIG(regularexpression)
#endif // Q_QDOC
//
// QString inline functions:
//
QStringList QString::split(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{ return split(sep, _sb(behavior), cs); }
QStringList QString::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{ return split(sep, _sb(behavior), cs); }
#ifndef QT_NO_REGEXP
QStringList QString::split(const QRegExp &sep, Qt::SplitBehavior behavior) const
{ return split(sep, _sb(behavior)); }
#endif
#if QT_CONFIG(regularexpression)
QStringList QString::split(const QRegularExpression &sep, Qt::SplitBehavior behavior) const
{ return split(sep, _sb(behavior)); }
#endif
QT_END_NAMESPACE
#endif // QSTRINGLIST_H

View File

@ -173,7 +173,7 @@ static ParsedRfcDateTime rfcDateImpl(const QString &s)
// or "ddd MMM dd[ hh:mm:ss] yyyy [±hhmm]" - permissive RFC 850, 1036 (read only)
ParsedRfcDateTime result;
auto words = s.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
auto words = s.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
if (words.size() < 3 || words.size() > 6)
return result;
const QChar colon(QLatin1Char(':'));
@ -1784,7 +1784,7 @@ QT_WARNING_POP
return rfcDateImpl(string).date;
default:
case Qt::TextDate: {
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
if (parts.count() != 4)
return QDate();
@ -5417,7 +5417,7 @@ QT_WARNING_POP
return QDateTime(date, time, spec, offset);
}
case Qt::TextDate: {
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
if ((parts.count() < 5) || (parts.count() > 6))
return QDateTime();

View File

@ -784,24 +784,6 @@ extern template class Q_CORE_EXPORT QVector<QPoint>;
QVector<uint> QStringView::toUcs4() const { return QtPrivate::convertToUcs4(*this); }
QVector<QStringRef> QString::splitRef(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{ return splitRef(sep, _sb(behavior), cs); }
QVector<QStringRef> QString::splitRef(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{ return splitRef(sep, _sb(behavior), cs); }
#ifndef QT_NO_REGEXP
QVector<QStringRef> QString::splitRef(const QRegExp &sep, Qt::SplitBehavior behavior) const
{ return splitRef(sep, _sb(behavior)); }
#endif
#if QT_CONFIG(regularexpression)
QVector<QStringRef> QString::splitRef(const QRegularExpression &sep, Qt::SplitBehavior behavior) const
{ return splitRef(sep, _sb(behavior)); }
#endif
QVector<QStringRef> QStringRef::split(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{ return split(sep, QString::_sb(behavior), cs); }
QVector<QStringRef> QStringRef::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
{ return split(sep, QString::_sb(behavior), cs); }
QT_END_NAMESPACE
#include <QtCore/qbytearraylist.h>

View File

@ -95,7 +95,7 @@ QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
} else {
interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName());
const QString organizationDomain = QCoreApplication::instance()->organizationDomain();
const auto domainName = organizationDomain.splitRef(QLatin1Char('.'), QString::SkipEmptyParts);
const auto domainName = organizationDomain.splitRef(QLatin1Char('.'), Qt::SkipEmptyParts);
if (domainName.isEmpty()) {
interface.prepend(QLatin1String("local."));
} else {

View File

@ -285,7 +285,7 @@ QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, con
interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName());
QStringList domainName =
QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'),
QString::SkipEmptyParts);
Qt::SkipEmptyParts);
if (domainName.isEmpty())
interface.prepend(QLatin1String("local."));
else

View File

@ -2118,7 +2118,7 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
dest.setColorTable(clut);
QString textsKeys = src.text();
const auto textKeyList = textsKeys.splitRef(QLatin1Char('\n'), QString::SkipEmptyParts);
const auto textKeyList = textsKeys.splitRef(QLatin1Char('\n'), Qt::SkipEmptyParts);
for (const auto &textKey : textKeyList) {
const auto textKeySplitted = textKey.split(QLatin1String(": "));
dest.setText(textKeySplitted[0].toString(), textKeySplitted[1].toString());

View File

@ -3852,8 +3852,8 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e)
d << eventClassName(type) << '(';
QtDebugUtils::formatQEnum(d, type);
d << ", device=";
QtDebugUtils::formatQEnum(d, e->device());
d << ", deviceType=";
QtDebugUtils::formatQEnum(d, e->deviceType());
d << ", pointerType=";
QtDebugUtils::formatQEnum(d, e->pointerType());
d << ", uniqueId=" << e->uniqueId()
@ -3865,9 +3865,9 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e)
QtDebugUtils::formatQFlags(d, e->buttons());
if (type == QEvent::TabletPress || type == QEvent::TabletMove)
d << ", pressure=" << e->pressure();
if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse)
if (e->deviceType() == QTabletEvent::RotationStylus || e->deviceType() == QTabletEvent::FourDMouse)
d << ", rotation=" << e->rotation();
if (e->device() == QTabletEvent::Airbrush)
if (e->deviceType() == QTabletEvent::Airbrush)
d << ", tangentialPressure=" << e->tangentialPressure();
}

View File

@ -1212,12 +1212,12 @@ Q_LOGGING_CATEGORY(lcQpaPluginLoading, "qt.qpa.plugin");
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
{
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'), QString::SkipEmptyParts);
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'), Qt::SkipEmptyParts);
QStringList platformArguments;
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
for (const auto &pluginArgument : plugins) {
// Split into platform name and arguments
QStringList arguments = pluginArgument.split(QLatin1Char(':'), QString::SkipEmptyParts);
QStringList arguments = pluginArgument.split(QLatin1Char(':'), Qt::SkipEmptyParts);
if (arguments.isEmpty())
continue;
const QString name = arguments.takeFirst().toLower();

View File

@ -788,7 +788,7 @@ QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter)
filter.indexOf(regexp, 0, &match);
if (match.hasMatch())
f = match.captured(2);
return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
return f.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else
return QStringList();
#endif

View File

@ -300,7 +300,7 @@ QByteArray QPdfWriter::documentXmpMetadata() const
/*!
\since 5.15
Adds \a fileName attachment to the PDF with (optional) \a mimeType
Adds \a fileName attachment to the PDF with (optional) \a mimeType.
\a data contains the raw file data to embed into the PDF file.
*/

View File

@ -1584,7 +1584,7 @@ QRect Declaration::rectValue() const
const QStringList func = v.variant.toStringList();
if (func.count() != 2 || func.at(0).compare(QLatin1String("rect")) != 0)
return QRect();
const auto args = func[1].splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
const auto args = func[1].splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
if (args.count() != 4)
return QRect();
QRect rect(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt());

View File

@ -510,7 +510,7 @@ void QNetworkReplyWasmImplPrivate::headersReceived(const QString &bufferString)
Q_Q(QNetworkReplyWasmImpl);
if (!bufferString.isEmpty()) {
QStringList headers = bufferString.split(QString::fromUtf8("\r\n"), QString::SkipEmptyParts);
QStringList headers = bufferString.split(QString::fromUtf8("\r\n"), Qt::SkipEmptyParts);
for (int i = 0; i < headers.size(); i++) {
QString headerName = headers.at(i).split(QString::fromUtf8(": ")).at(0);

View File

@ -110,6 +110,7 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate()
/*!
\class QNetworkConfigurationManager
\obsolete
\brief The QNetworkConfigurationManager class manages the network configurations provided
by the system.

View File

@ -40,16 +40,31 @@
#ifndef QNETWORKCONFIGMANAGER_H
#define QNETWORKCONFIGMANAGER_H
#if 0
#pragma qt_class(QNetworkConfigurationManager)
#endif
#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qobject.h>
#include <QtNetwork/qnetworkconfiguration.h>
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
#ifndef QT_NO_BEARERMANAGEMENT
QT_BEGIN_NAMESPACE
class QNetworkConfigurationManagerPrivate;
class Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject
// We work around an issue in ICC where it errors out during compilation of Qt by not marking it
// deprecated if ICC is used
#ifdef Q_CC_INTEL
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
#else
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC QT_DEPRECATED_VERSION_5_15
#endif
class QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject
#undef QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
{
Q_OBJECT
@ -97,4 +112,6 @@ QT_END_NAMESPACE
#endif // QT_NO_BEARERMANAGEMENT
QT_WARNING_POP
#endif // QNETWORKCONFIGMANAGER_H

View File

@ -45,6 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QNetworkConfiguration
\obsolete
\brief The QNetworkConfiguration class provides an abstraction of one or more access point configurations.

View File

@ -40,6 +40,10 @@
#ifndef QNETWORKCONFIGURATION_H
#define QNETWORKCONFIGURATION_H
#if 0
#pragma qt_class(QNetworkConfiguration)
#endif
#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qshareddata.h>
@ -47,10 +51,21 @@
#include <QtCore/qlist.h>
#include <QtCore/qmetatype.h>
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QT_BEGIN_NAMESPACE
class QNetworkConfigurationPrivate;
class Q_NETWORK_EXPORT QNetworkConfiguration
// We work around an issue in ICC where it errors out during compilation of Qt by not marking it
// deprecated if ICC is used
#ifdef Q_CC_INTEL
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
#else
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC QT_DEPRECATED_VERSION_5_15
#endif
class QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC Q_NETWORK_EXPORT QNetworkConfiguration
#undef QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
{
public:
QNetworkConfiguration();
@ -135,4 +150,6 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QNetworkConfiguration)
QT_WARNING_POP
#endif // QNETWORKCONFIGURATION_H

View File

@ -59,6 +59,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QNetworkSession
\obsolete
\brief The QNetworkSession class provides control over the system's access points
and enables session management for cases when multiple clients access the same access point.

View File

@ -40,6 +40,10 @@
#ifndef QNETWORKSESSION_H
#define QNETWORKSESSION_H
#if 0
#pragma qt_class(QNetworkSession)
#endif
#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
@ -47,6 +51,9 @@
#include <QtCore/qvariant.h>
#include <QtNetwork/qnetworkconfiguration.h>
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
#ifndef QT_NO_BEARERMANAGEMENT
#if defined(Q_OS_WIN) && defined(interface)
@ -57,7 +64,15 @@
QT_BEGIN_NAMESPACE
class QNetworkSessionPrivate;
class Q_NETWORK_EXPORT QNetworkSession : public QObject
// We work around an issue in ICC where it errors out during compilation of Qt by not marking it
// deprecated if ICC is used
#ifdef Q_CC_INTEL
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
#else
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC QT_DEPRECATED_VERSION_5_15
#endif
class QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC Q_NETWORK_EXPORT QNetworkSession : public QObject
#undef QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
{
Q_OBJECT
@ -147,4 +162,6 @@ Q_DECLARE_METATYPE(QNetworkSession::UsagePolicies)
#endif // QT_NO_BEARERMANAGEMENT
QT_WARNING_POP
#endif // QNETWORKSESSION_H

View File

@ -320,7 +320,7 @@ qt_feature("networkdiskcache" PUBLIC
qt_feature_definition("networkdiskcache" "QT_NO_NETWORKDISKCACHE" NEGATE VALUE "1")
qt_feature("bearermanagement" PUBLIC
SECTION "Networking"
LABEL "Bearer management"
LABEL "Bearer management (deprecated)"
PURPOSE "Provides bearer management for the network stack."
CONDITION QT_FEATURE_thread AND QT_FEATURE_library AND QT_FEATURE_networkinterface AND QT_FEATURE_properties
)

View File

@ -388,7 +388,7 @@
"output": [ "publicFeature", "feature" ]
},
"bearermanagement": {
"label": "Bearer management",
"label": "Bearer management (deprecated)",
"purpose": "Provides bearer management for the network stack.",
"section": "Networking",
"condition": "features.thread && features.library && features.networkinterface && features.properties",

View File

@ -76,6 +76,8 @@ public:
explicit QNetworkProxyQuery(quint16 bindPort, const QString &protocolTag = QString(),
QueryType queryType = TcpServer);
#if !defined(QT_NO_BEARERMANAGEMENT) && QT_DEPRECATED_SINCE(5, 10)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
Q_DECL_DEPRECATED_X("QNetworkConfiguration support in QNetworkProxy is deprecated")
QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration,
const QUrl &requestUrl, QueryType queryType = UrlRequest);
@ -87,6 +89,7 @@ public:
QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration,
quint16 bindPort, const QString &protocolTag = QString(),
QueryType queryType = TcpServer);
QT_WARNING_POP
#endif
QNetworkProxyQuery(const QNetworkProxyQuery &other);
QNetworkProxyQuery &operator=(QNetworkProxyQuery &&other) noexcept { swap(other); return *this; }
@ -118,10 +121,13 @@ public:
void setUrl(const QUrl &url);
#if !defined(QT_NO_BEARERMANAGEMENT) && QT_DEPRECATED_SINCE(5, 10)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
Q_DECL_DEPRECATED_X("QNetworkConfiguration support in QNetworkProxy is deprecated")
QNetworkConfiguration networkConfiguration() const;
Q_DECL_DEPRECATED_X("QNetworkConfiguration support in QNetworkProxy is deprecated")
void setNetworkConfiguration(const QNetworkConfiguration &networkConfiguration);
QT_WARNING_POP
#endif
private:

View File

@ -97,7 +97,7 @@ static bool containsTLDEntry(QStringView entry, TLDMatchType match)
Q_NETWORK_EXPORT QString qTopLevelDomain(const QString &domain)
{
const QString domainLower = domain.toLower();
QVector<QStringRef> sections = domainLower.splitRef(QLatin1Char('.'), QString::SkipEmptyParts);
QVector<QStringRef> sections = domainLower.splitRef(QLatin1Char('.'), Qt::SkipEmptyParts);
if (sections.isEmpty())
return QString();

View File

@ -1456,7 +1456,7 @@ void QSslSocket::setCiphers(const QString &ciphers)
{
Q_D(QSslSocket);
d->configuration.ciphers.clear();
const auto cipherNames = ciphers.split(QLatin1Char(':'), QString::SkipEmptyParts);
const auto cipherNames = ciphers.split(QLatin1Char(':'), Qt::SkipEmptyParts);
for (const QString &cipherName : cipherNames) {
QSslCipher cipher(cipherName);
if (!cipher.isNull())

View File

@ -374,7 +374,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(const SSL_CIPHER
char buf [256];
QString descriptionOneLine = QString::fromLatin1(q_SSL_CIPHER_description(cipher, buf, sizeof(buf)));
const auto descriptionList = descriptionOneLine.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
const auto descriptionList = descriptionOneLine.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
if (descriptionList.size() > 5) {
// ### crude code.
ciph.d->isNull = false;

View File

@ -574,7 +574,7 @@ static QStringList libraryPathList()
QStringList paths;
# ifdef Q_OS_DARWIN
paths = QString::fromLatin1(qgetenv("DYLD_LIBRARY_PATH"))
.split(QLatin1Char(':'), QString::SkipEmptyParts);
.split(QLatin1Char(':'), Qt::SkipEmptyParts);
// search in .app/Contents/Frameworks
UInt32 packageType;
@ -586,7 +586,7 @@ static QStringList libraryPathList()
}
# else
paths = QString::fromLatin1(qgetenv("LD_LIBRARY_PATH"))
.split(QLatin1Char(':'), QString::SkipEmptyParts);
.split(QLatin1Char(':'), Qt::SkipEmptyParts);
# endif
paths << QLatin1String("/lib") << QLatin1String("/usr/lib") << QLatin1String("/usr/local/lib");
paths << QLatin1String("/lib64") << QLatin1String("/usr/lib64") << QLatin1String("/usr/local/lib64");

View File

@ -216,7 +216,7 @@ bool QDeviceDiscoveryUDev::checkDeviceType(udev_device *dev)
if ((m_types & Device_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )) {
const QString capabilities_key = QString::fromUtf8(udev_device_get_sysattr_value(dev, "capabilities/key"));
const auto val = capabilities_key.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
const auto val = capabilities_key.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
if (!val.isEmpty()) {
bool ok;
unsigned long long keys = val.last().toULongLong(&ok, 16);

View File

@ -2050,10 +2050,10 @@ QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int of
int endOffset;
QString joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
const QStringList attributes = joined.split (QLatin1Char(';'), QString::SkipEmptyParts, Qt::CaseSensitive);
const QStringList attributes = joined.split (QLatin1Char(';'), Qt::SkipEmptyParts, Qt::CaseSensitive);
for (const QString &attr : attributes) {
QStringList items;
items = attr.split(QLatin1Char(':'), QString::SkipEmptyParts, Qt::CaseSensitive);
items = attr.split(QLatin1Char(':'), Qt::SkipEmptyParts, Qt::CaseSensitive);
AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
if (!attribute.isNull())
set[attribute.name] = attribute.value;
@ -2074,10 +2074,10 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in
int endOffset;
joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
const QStringList attributes = joined.split (QLatin1Char(';'), QString::SkipEmptyParts, Qt::CaseSensitive);
const QStringList attributes = joined.split (QLatin1Char(';'), Qt::SkipEmptyParts, Qt::CaseSensitive);
for (const QString& attr : attributes) {
QStringList items;
items = attr.split(QLatin1Char(':'), QString::SkipEmptyParts, Qt::CaseSensitive);
items = attr.split(QLatin1Char(':'), Qt::SkipEmptyParts, Qt::CaseSensitive);
AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
if (!attribute.isNull())
map[attribute.name] = attribute.value;

View File

@ -641,7 +641,7 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
const QString kdeDirsVar = QFile::decodeName(qgetenv("KDEDIRS"));
if (!kdeDirsVar.isEmpty())
kdeDirs += kdeDirsVar.split(QLatin1Char(':'), QString::SkipEmptyParts);
kdeDirs += kdeDirsVar.split(QLatin1Char(':'), Qt::SkipEmptyParts);
const QString kdeVersionHomePath = QDir::homePath() + QLatin1String("/.kde") + QLatin1String(kdeVersionBA);
if (QFileInfo(kdeVersionHomePath).isDir())

View File

@ -44,9 +44,10 @@
#include <QDebug>
AndroidContentFileEngine::AndroidContentFileEngine(const QString &fileName)
: QFSFileEngine(fileName)
AndroidContentFileEngine::AndroidContentFileEngine(const QString &f)
: m_file(f)
{
setFileName(f);
}
bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
@ -78,6 +79,48 @@ bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
return QFSFileEngine::open(openMode, fd, QFile::AutoCloseHandle);
}
qint64 AndroidContentFileEngine::size() const
{
const jlong size = QJNIObjectPrivate::callStaticMethod<jlong>(
"org/qtproject/qt5/android/QtNative", "getSize",
"(Landroid/content/Context;Ljava/lang/String;)J", QtAndroidPrivate::context(),
QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
return (qint64)size;
}
AndroidContentFileEngine::FileFlags AndroidContentFileEngine::fileFlags(FileFlags type) const
{
FileFlags commonFlags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag);
FileFlags flags;
const bool exists = QJNIObjectPrivate::callStaticMethod<jboolean>(
"org/qtproject/qt5/android/QtNative", "checkFileExists",
"(Landroid/content/Context;Ljava/lang/String;)Z", QtAndroidPrivate::context(),
QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
if (!exists)
return flags;
flags = FileType | commonFlags;
return type & flags;
}
QString AndroidContentFileEngine::fileName(FileName f) const
{
switch (f) {
case PathName:
case AbsolutePathName:
case CanonicalPathName:
case DefaultName:
case AbsoluteName:
case CanonicalName:
return m_file;
case BaseName:
{
const int pos = m_file.lastIndexOf(QChar(QLatin1Char('/')));
return m_file.mid(pos);
}
default:
return QString();
}
}
AndroidContentFileEngineHandler::AndroidContentFileEngineHandler() = default;
AndroidContentFileEngineHandler::~AndroidContentFileEngineHandler() = default;

View File

@ -47,6 +47,12 @@ class AndroidContentFileEngine : public QFSFileEngine
public:
AndroidContentFileEngine(const QString &fileName);
bool open(QIODevice::OpenMode openMode) override;
qint64 size() const override;
FileFlags fileFlags(FileFlags type = FileInfoAll) const override;
QString fileName(FileName file = DefaultName) const override;
private:
QString m_file;
};
class AndroidContentFileEngineHandler : public QAbstractFileEngineHandler

View File

@ -225,7 +225,7 @@ void QXdgDesktopPortalFileDialog::openPortal()
QRegularExpressionMatch match = regexp.match(filter);
if (match.hasMatch()) {
QString userVisibleName = match.captured(1);
QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), QString::SkipEmptyParts);
QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), Qt::SkipEmptyParts);
FilterConditionList filterConditions;
for (const QString &filterString : filterStrings) {

View File

@ -1270,7 +1270,7 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas
QString protocol;
// Set connection attributes
const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
for (int i = 0; i < opts.count(); ++i) {
const QString tmp(opts.at(i));
int idx;

View File

@ -1477,7 +1477,7 @@ bool QIBaseDriver::open(const QString & db,
if (isOpen())
close();
const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
QString encString;
QByteArray role;

View File

@ -1239,7 +1239,7 @@ bool QMYSQLDriver::open(const QString& db,
stored procedure call will fail.
*/
unsigned int optionFlags = CLIENT_MULTI_STATEMENTS;
const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
QString unixSocket;
QString sslCert;
QString sslCA;

View File

@ -2230,7 +2230,7 @@ bool QOCIDriver::hasFeature(DriverFeature f) const
static void qParseOpts(const QString &options, QOCIDriverPrivate *d)
{
const QStringList opts(options.split(QLatin1Char(';'), QString::SkipEmptyParts));
const QStringList opts(options.split(QLatin1Char(';'), Qt::SkipEmptyParts));
for (int i = 0; i < opts.count(); ++i) {
const QString tmp(opts.at(i));
int idx;

View File

@ -767,7 +767,7 @@ QChar QODBCDriverPrivate::quoteChar()
bool QODBCDriverPrivate::setConnectionOptions(const QString& connOpts)
{
// Set any connection attributes
const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
SQLRETURN r = SQL_SUCCESS;
for (int i = 0; i < opts.count(); ++i) {
const QString tmp(opts.at(i));

View File

@ -906,7 +906,7 @@ bool readInputFile(Options *options)
{
const QJsonValue extraLibs = jsonObject.value(QLatin1String("android-extra-libs"));
if (!extraLibs.isUndefined())
options->extraLibs = extraLibs.toString().split(QLatin1Char(','), QString::SkipEmptyParts);
options->extraLibs = extraLibs.toString().split(QLatin1Char(','), Qt::SkipEmptyParts);
}
{
@ -996,7 +996,7 @@ bool readInputFile(Options *options)
}
{
const QJsonValue qrcFiles = jsonObject.value(QLatin1String("qrcFiles"));
options->qrcFiles = qrcFiles.toString().split(QLatin1Char(','), QString::SkipEmptyParts);
options->qrcFiles = qrcFiles.toString().split(QLatin1Char(','), Qt::SkipEmptyParts);
}
options->packageName = packageNameFromAndroidManifest(options->androidSourceDirectory + QLatin1String("/AndroidManifest.xml"));
if (options->packageName.isEmpty())

View File

@ -296,8 +296,7 @@ Provider parseProvider(const QString &filename)
if (tracedef.exactMatch(line)) {
const QString name = tracedef.cap(1);
const QString argsString = tracedef.cap(2);
const QStringList args = argsString.split(QLatin1Char(','),
QString::SkipEmptyParts);
const QStringList args = argsString.split(QLatin1Char(','), Qt::SkipEmptyParts);
provider.tracepoints << parseTracepoint(name, args, filename, lineNumber);
} else {

View File

@ -4370,7 +4370,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const
QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']'));
#if defined(Q_OS_WIN)
QStringList parts = pathCopy.split(re, QString::SkipEmptyParts);
QStringList parts = pathCopy.split(re, Qt::SkipEmptyParts);
if (!doubleSlash.isEmpty() && !parts.isEmpty())
parts[0].prepend(doubleSlash);
if (pathCopy.endsWith(sep))

View File

@ -376,7 +376,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
absolutePath = QDir(longPath).absolutePath();
// ### TODO can we use bool QAbstractFileEngine::caseSensitive() const?
QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
QStringList pathElements = absolutePath.split(QLatin1Char('/'), Qt::SkipEmptyParts);
if ((pathElements.isEmpty())
#if !defined(Q_OS_WIN)
&& QDir::fromNativeSeparators(longPath) != QLatin1String("/")

View File

@ -189,7 +189,6 @@ public:
int decimals = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(),
double step = 1);
#else
// ### Qt 6: merge overloads
static double getDouble(QWidget *parent, const QString &title, const QString &label, double value,
double minValue, double maxValue, int decimals, bool *ok, Qt::WindowFlags flags,
double step);

View File

@ -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;

View File

@ -873,7 +873,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
}
#endif
QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
QStringList pathElements = absolutePath.split(QLatin1Char('/'), Qt::SkipEmptyParts);
if ((pathElements.isEmpty() || !QFileInfo::exists(path))
#if !defined(Q_OS_WIN)
&& path != QLatin1String("/")

View File

@ -1073,7 +1073,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
if (widget) {
QPointF delta = event->globalPosF() - event->globalPos();
QPointF mapped = widget->mapFromGlobal(event->globalPos()) + delta;
QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->device(), event->pointerType(),
QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->deviceType(), event->pointerType(),
event->pressure(), event->xTilt(), event->yTilt(), event->tangentialPressure(),
event->rotation(), event->z(), event->modifiers(), event->uniqueId(), event->button(), event->buttons());
ev.setTimestamp(event->timestamp());

View File

@ -103,10 +103,10 @@ public:
void moveTab(int from, int to);
bool isTabEnabled(int index) const;
void setTabEnabled(int index, bool);
void setTabEnabled(int index, bool enabled);
bool isTabVisible(int index) const;
void setTabVisible(int index, bool);
void setTabVisible(int index, bool visible);
QString tabText(int index) const;
void setTabText(int index, const QString &text);
@ -118,7 +118,7 @@ public:
void setTabIcon(int index, const QIcon &icon);
Qt::TextElideMode elideMode() const;
void setElideMode(Qt::TextElideMode);
void setElideMode(Qt::TextElideMode mode);
#ifndef QT_NO_TOOLTIP
void setTabToolTip(int index, const QString &tip);

View File

@ -80,13 +80,13 @@ public:
void removeTab(int index);
bool isTabEnabled(int index) const;
void setTabEnabled(int index, bool);
void setTabEnabled(int index, bool enabled);
bool isTabVisible(int index) const;
void setTabVisible(int index, bool);
void setTabVisible(int index, bool visible);
QString tabText(int index) const;
void setTabText(int index, const QString &);
void setTabText(int index, const QString &text);
QIcon tabIcon(int index) const;
void setTabIcon(int index, const QIcon & icon);
@ -110,7 +110,7 @@ public:
enum TabPosition { North, South, West, East };
Q_ENUM(TabPosition)
TabPosition tabPosition() const;
void setTabPosition(TabPosition);
void setTabPosition(TabPosition position);
bool tabsClosable() const;
void setTabsClosable(bool closeable);
@ -132,7 +132,7 @@ public:
QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
Qt::TextElideMode elideMode() const;
void setElideMode(Qt::TextElideMode);
void setElideMode(Qt::TextElideMode mode);
QSize iconSize() const;
void setIconSize(const QSize &size);

View File

@ -1786,9 +1786,9 @@ void tst_QDir::searchPaths()
{
QFETCH(QString, filename);
QFETCH(QString, searchPathPrefixes);
QStringList searchPathPrefixList = searchPathPrefixes.split(";", QString::SkipEmptyParts);
QStringList searchPathPrefixList = searchPathPrefixes.split(";", Qt::SkipEmptyParts);
QFETCH(QString, searchPaths);
QStringList searchPathsList = searchPaths.split(";", QString::SkipEmptyParts);
QStringList searchPathsList = searchPaths.split(";", Qt::SkipEmptyParts);
QFETCH(QString, expectedAbsolutePath);
bool exists = !expectedAbsolutePath.isEmpty();

View File

@ -2401,7 +2401,7 @@ void tst_QProcess::finishProcessBeforeReadingDone()
QVERIFY(process.waitForStarted());
loop.exec();
QStringList lines = QString::fromLocal8Bit(process.readAllStandardOutput()).split(
QRegExp(QStringLiteral("[\r\n]")), QString::SkipEmptyParts);
QRegExp(QStringLiteral("[\r\n]")), Qt::SkipEmptyParts);
QVERIFY(!lines.isEmpty());
QCOMPARE(lines.last(), QStringLiteral("10239 -this is a number"));
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
@ -2599,7 +2599,7 @@ void tst_QProcess::finishProcessBeforeReadingDone_deprecated()
QVERIFY(process.waitForStarted());
loop.exec();
QStringList lines = QString::fromLocal8Bit(process.readAllStandardOutput()).split(
QRegExp(QStringLiteral("[\r\n]")), QString::SkipEmptyParts);
QRegExp(QStringLiteral("[\r\n]")), Qt::SkipEmptyParts);
QVERIFY(!lines.isEmpty());
QCOMPARE(lines.last(), QStringLiteral("10239 -this is a number"));
QCOMPARE(process.exitStatus(), QProcess::NormalExit);

View File

@ -360,7 +360,7 @@ static inline QFileInfo findSh()
QLatin1String sh("/sh");
QByteArray pEnv = qgetenv("PATH");
const QLatin1Char pathSep(':');
const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(pathSep, QString::SkipEmptyParts);
const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(pathSep, Qt::SkipEmptyParts);
foreach (const QString &path, rawPaths) {
if (QFile::exists(path + sh))
return path + sh;

View File

@ -427,7 +427,7 @@ void tst_QMimeDatabase::listAliases()
QFETCH(QString, inputMime);
QFETCH(QString, expectedAliases);
QMimeDatabase db;
QStringList expectedAliasesList = expectedAliases.split(',', QString::SkipEmptyParts);
QStringList expectedAliasesList = expectedAliases.split(',', Qt::SkipEmptyParts);
expectedAliasesList.sort();
QMimeType mime = db.mimeTypeForName(inputMime);
QVERIFY(mime.isValid());
@ -715,7 +715,7 @@ void tst_QMimeDatabase::findByFileName_data()
continue;
QString string = QString::fromLatin1(line.constData(), len - 1).trimmed();
QStringList list = string.split(QLatin1Char(' '), QString::SkipEmptyParts);
QStringList list = string.split(QLatin1Char(' '), Qt::SkipEmptyParts);
QVERIFY(list.size() >= 2);
QString filePath = list.at(0);

View File

@ -2162,18 +2162,18 @@ void tst_QStringRef::split()
QVERIFY(list == result);
}
list = ref.split(sep, QString::KeepEmptyParts);
list = ref.split(sep, Qt::KeepEmptyParts);
QVERIFY(list == result);
if (sep.size() == 1) {
list = ref.split(sep.at(0), QString::KeepEmptyParts);
list = ref.split(sep.at(0), Qt::KeepEmptyParts);
QVERIFY(list == result);
}
result.removeAll("");
list = ref.split(sep, QString::SkipEmptyParts);
list = ref.split(sep, Qt::SkipEmptyParts);
QVERIFY(list == result);
if (sep.size() == 1) {
list = ref.split(sep.at(0), QString::SkipEmptyParts);
list = ref.split(sep.at(0), Qt::SkipEmptyParts);
QVERIFY(list == result);
}
}

View File

@ -124,7 +124,7 @@ static void generateDataFromFile(const QString &fname)
QString testString;
QList<int> expectedBreakPositions;
foreach (const QString &part, test.simplified().split(QLatin1Char(' '), QString::SkipEmptyParts)) {
foreach (const QString &part, test.simplified().split(QLatin1Char(' '), Qt::SkipEmptyParts)) {
if (part.size() == 1) {
if (part.at(0).unicode() == 0xf7)
expectedBreakPositions.append(testString.size());
@ -146,7 +146,7 @@ static void generateDataFromFile(const QString &fname)
QVERIFY(!expectedBreakPositions.isEmpty());
if (!comments.isEmpty()) {
const QStringList lst = comments.simplified().split(QLatin1Char(' '), QString::SkipEmptyParts);
const QStringList lst = comments.simplified().split(QLatin1Char(' '), Qt::SkipEmptyParts);
comments.clear();
foreach (const QString &part, lst) {
if (part.size() == 1) {

View File

@ -890,7 +890,7 @@ void PaintCommands::command_import(QRegularExpressionMatch re)
m_commands[m_currentCommandIndex] = QLatin1String("# import file (") + fileinfo.fileName()
+ QLatin1String(") start");
QString rawContent = QString::fromUtf8(file->readAll());
QStringList importedData = rawContent.split('\n', QString::SkipEmptyParts);
QStringList importedData = rawContent.split('\n', Qt::SkipEmptyParts);
importedData.append(QLatin1String("# import file (") + fileinfo.fileName() + QLatin1String(") end ---"));
insertAt(m_currentCommandIndex, importedData);
@ -1146,7 +1146,7 @@ void PaintCommands::command_drawPolygon(QRegularExpressionMatch re)
static QRegularExpression separators("\\s");
QStringList caps = re.capturedTexts();
QString cap = caps.at(1);
QStringList numbers = cap.split(separators, QString::SkipEmptyParts);
QStringList numbers = cap.split(separators, Qt::SkipEmptyParts);
QPolygonF array;
for (int i=0; i + 1<numbers.size(); i+=2)
@ -1162,7 +1162,7 @@ void PaintCommands::command_drawPolygon(QRegularExpressionMatch re)
void PaintCommands::command_drawPolyline(QRegularExpressionMatch re)
{
static QRegularExpression separators("\\s");
QStringList numbers = re.captured(1).split(separators, QString::SkipEmptyParts);
QStringList numbers = re.captured(1).split(separators, Qt::SkipEmptyParts);
QPolygonF array;
for (int i=0; i + 1<numbers.size(); i+=2)
@ -1455,7 +1455,7 @@ void PaintCommands::command_path_addPolygon(QRegularExpressionMatch re)
QStringList caps = re.capturedTexts();
QString name = caps.at(1);
QString cap = caps.at(2);
QStringList numbers = cap.split(separators, QString::SkipEmptyParts);
QStringList numbers = cap.split(separators, Qt::SkipEmptyParts);
QPolygonF array;
for (int i=0; i + 1<numbers.size(); i+=2)
@ -2686,7 +2686,7 @@ void PaintCommands::command_pen_setDashPattern(QRegularExpressionMatch re)
static QRegularExpression separators("\\s");
QStringList caps = re.capturedTexts();
QString cap = caps.at(1);
QStringList numbers = cap.split(separators, QString::SkipEmptyParts);
QStringList numbers = cap.split(separators, Qt::SkipEmptyParts);
QVector<qreal> pattern;
for (int i=0; i<numbers.size(); ++i)
@ -2722,7 +2722,7 @@ void PaintCommands::command_drawConvexPolygon(QRegularExpressionMatch re)
static QRegularExpression separators("\\s");
QStringList caps = re.capturedTexts();
QString cap = caps.at(1);
QStringList numbers = cap.split(separators, QString::SkipEmptyParts);
QStringList numbers = cap.split(separators, Qt::SkipEmptyParts);
QPolygonF array;
for (int i=0; i + 1<numbers.size(); i+=2)

View File

@ -129,7 +129,7 @@ void tst_Lancelot::initTestCase()
QFile file(scriptsDir + fileName);
file.open(QFile::ReadOnly);
QByteArray cont = file.readAll();
scripts.insert(fileName, QString::fromUtf8(cont).split(QLatin1Char('\n'), QString::SkipEmptyParts));
scripts.insert(fileName, QString::fromUtf8(cont).split(QLatin1Char('\n'), Qt::SkipEmptyParts));
scriptChecksums.insert(fileName, qChecksum(cont.constData(), cont.size()));
}
}

View File

@ -766,7 +766,7 @@ void tst_QAccessibility::textAttributes()
QCOMPARE(startOffset, startOffsetResult);
QCOMPARE(endOffset, endOffsetResult);
QStringList attrList = attributes.split(QChar(';'), QString::SkipEmptyParts);
QStringList attrList = attributes.split(QChar(';'), Qt::SkipEmptyParts);
attributeResult.sort();
attrList.sort();
QCOMPARE(attrList, attributeResult);

View File

@ -2859,7 +2859,7 @@ void tst_qmakelib::proEval()
QString infile = m_indir + "/test.pro";
bool verified = true;
QMakeTestHandler handler;
handler.setExpectedMessages(msgs.replace("##:", infile + ':').split('\n', QString::SkipEmptyParts));
handler.setExpectedMessages(msgs.replace("##:", infile + ':').split('\n', Qt::SkipEmptyParts));
QMakeVfs vfs;
ProFileCache cache;
QMakeParser parser(&cache, &vfs, &handler);

View File

@ -2028,7 +2028,7 @@ void tst_qmakelib::proParser()
bool verified = true;
QMakeTestHandler handler;
handler.setExpectedMessages(msgs.split('\n', QString::SkipEmptyParts));
handler.setExpectedMessages(msgs.split('\n', Qt::SkipEmptyParts));
QMakeVfs vfs;
QMakeParser parser(0, &vfs, &handler);
ProFile *pro = parser.parsedProBlock(QStringRef(&in), 0, "in", 1, QMakeParser::FullGrammar);

View File

@ -176,7 +176,7 @@ void tst_rcc::rcc_data()
}
static QStringList readLinesFromFile(const QString &fileName,
QString::SplitBehavior splitBehavior)
Qt::SplitBehavior splitBehavior)
{
QFile file(fileName);
@ -226,7 +226,7 @@ void tst_rcc::rcc()
const QStringList actualLines = out.split(nl);
const QStringList expectedLines =
readLinesFromFile(directory + QLatin1Char('/') + expected, QString::KeepEmptyParts);
readLinesFromFile(directory + QLatin1Char('/') + expected, Qt::KeepEmptyParts);
QVERIFY(!expectedLines.isEmpty());
const QString diff = doCompare(actualLines, expectedLines, directory);
@ -238,7 +238,7 @@ static QStringMap readExpectedFiles(const QString &fileName)
{
QStringMap expectedFiles;
QStringList lines = readLinesFromFile(fileName, QString::SkipEmptyParts);
QStringList lines = readLinesFromFile(fileName, Qt::SkipEmptyParts);
foreach (const QString &line, lines) {
QString resourceFileName = line.section(QLatin1Char(' '), 0, 0, QString::SectionSkipEmpty);
QString actualFileName = line.section(QLatin1Char(' '), 1, 1, QString::SectionSkipEmpty);
@ -304,7 +304,7 @@ void tst_rcc::binary_data()
QString localeFileName = absoluteBaseName + QLatin1String(".locale");
QFile localeFile(localeFileName);
if (localeFile.exists()) {
QStringList locales = readLinesFromFile(localeFileName, QString::SkipEmptyParts);
QStringList locales = readLinesFromFile(localeFileName, Qt::SkipEmptyParts);
foreach (const QString &locale, locales) {
QString expectedFileName = QString::fromLatin1("%1.%2.%3").arg(absoluteBaseName, locale, QLatin1String("expected"));
QStringMap expectedFiles = readExpectedFiles(expectedFileName);
@ -483,9 +483,9 @@ void tst_rcc::python()
QVERIFY2(process.exitCode() == 0,
msgProcessFailed(process).constData());
const auto actualLines = readLinesFromFile(actualFile, QString::KeepEmptyParts);
const auto actualLines = readLinesFromFile(actualFile, Qt::KeepEmptyParts);
QVERIFY(!actualLines.isEmpty());
const auto expectedLines = readLinesFromFile(expectedFile, QString::KeepEmptyParts);
const auto expectedLines = readLinesFromFile(expectedFile, Qt::KeepEmptyParts);
QVERIFY(!expectedLines.isEmpty());
const QString diff = doCompare(actualLines, expectedLines, path);
if (!diff.isEmpty())

View File

@ -11732,7 +11732,7 @@ public:
QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(Qt::Vertical);
QLatin1String wiseWords("AZ BUKI VEDI");
QString sentence(wiseWords);
QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts);
QStringList words = sentence.split(QLatin1Char(' '), Qt::SkipEmptyParts);
for (int i = 0; i < words.count(); ++i) {
QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
QLabel *label = new QLabel(words.at(i));

View File

@ -110,7 +110,7 @@ void tst_LanceBench::initTestCase()
QFile file(scriptsDir + fileName);
file.open(QFile::ReadOnly);
QByteArray cont = file.readAll();
scripts.insert(fileName, QString::fromUtf8(cont).split(QLatin1Char('\n'), QString::SkipEmptyParts));
scripts.insert(fileName, QString::fromUtf8(cont).split(QLatin1Char('\n'), Qt::SkipEmptyParts));
}
}

View File

@ -123,7 +123,7 @@ void tst_QText::shaping_data()
QVERIFY(file.open(QFile::ReadOnly));
QByteArray data = file.readAll();
QVERIFY(data.count() > 1000);
QStringList list = QString::fromUtf8(data.data()).split(QLatin1Char('\n'), QString::SkipEmptyParts);
QStringList list = QString::fromUtf8(data.data()).split(QLatin1Char('\n'), Qt::SkipEmptyParts);
QVERIFY(list.count() %2 == 0); // even amount as we have title and then content.
for (int i=0; i < list.count(); i+=2) {
QTest::newRow(list.at(i).toLatin1()) << list.at(i+1);

View File

@ -307,7 +307,7 @@ QFileDialog::Options FileDialogPanel::options() const
QStringList FileDialogPanel::allowedSchemes() const
{
return m_allowedSchemes->text().simplified().split(' ', QString::SkipEmptyParts);
return m_allowedSchemes->text().simplified().split(' ', Qt::SkipEmptyParts);
}
void FileDialogPanel::getOpenFileNames()
@ -468,7 +468,7 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
if (!file.isEmpty())
d->selectFile(file);
const QString filter = m_selectedNameFilter->text().trimmed();
const QStringList filters = m_nameFilters->toPlainText().trimmed().split(QLatin1Char('\n'), QString::SkipEmptyParts);
const QStringList filters = m_nameFilters->toPlainText().trimmed().split(QLatin1Char('\n'), Qt::SkipEmptyParts);
if (!m_useMimeTypeFilters->isChecked()) {
d->setNameFilters(filters);
if (!filter.isEmpty())

View File

@ -110,7 +110,7 @@ void DragWidget::dropEvent(QDropEvent *event)
if (event->mimeData()->hasText()) {
const QMimeData *mime = event->mimeData();
QStringList pieces = mime->text().split(QRegularExpression("\\s+"),
QString::SkipEmptyParts);
Qt::SkipEmptyParts);
QPoint position = event->pos();
QPoint hotSpot;

View File

@ -364,7 +364,7 @@ int main(int argc, char **argv)
if (file.open(QIODevice::ReadOnly)) {
QTextStream textFile(&file);
QString script = textFile.readAll();
content = script.split("\n", QString::SkipEmptyParts);
content = script.split("\n", Qt::SkipEmptyParts);
} else {
printf("failed to read file: '%s'\n", qPrintable(fileinfo.absoluteFilePath()));
continue;

View File

@ -54,7 +54,7 @@ struct testDataSet
QString charHexCsv2String(const QString &csv)
{
QString result;
foreach (const QString &charString, csv.split(QLatin1Char(','), QString::SkipEmptyParts)) {
foreach (const QString &charString, csv.split(QLatin1Char(','), Qt::SkipEmptyParts)) {
bool isOk;
const uint charUInt = charString.toUInt(&isOk, 16);
Q_ASSERT(isOk);

View File

@ -405,7 +405,7 @@ void AccessibilitySceneManager::addGraphicsItems(AccessibilitySceneManager::Tree
QString text;
text += item.name + "\n";
text += item.role + "\n";
text += item.description.split(" ", QString::SkipEmptyParts).join("\n") + "\n";
text += item.description.split(QLatin1Char(' '), Qt::SkipEmptyParts).join("\n") + "\n";
text += "P:" + QString::number(item.rect.x()) + " " + QString::number(item.rect.y()) + " ";
text += "S:" + QString::number(item.rect.width()) + " " + QString::number(item.rect.height()) + "\n";