mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Suppress Qt 5.15 deprecation warnings
This commit is contained in:
@@ -52,7 +52,7 @@ namespace BlackMisc
|
||||
|
||||
CLogCategoryList CLogCategoryList::fromQString(const QString &string)
|
||||
{
|
||||
return fromQStringList(string.split("|", QString::SkipEmptyParts));
|
||||
return fromQStringList(string.split("|", Qt::SkipEmptyParts));
|
||||
}
|
||||
|
||||
bool CLogCategoryList::anyStartWith(const QString &prefix) const
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace BlackMisc
|
||||
QFileInfo fileInfo(fullPath);
|
||||
|
||||
QStringList dirNames;
|
||||
dirNames.append(relativePath.split('/', QString::SkipEmptyParts));
|
||||
dirNames.append(relativePath.split('/', Qt::SkipEmptyParts));
|
||||
// Replace the first one being the package name with the package root dir
|
||||
QString packageRootDir = package.path.mid(package.path.lastIndexOf('/') + 1);
|
||||
dirNames.replace(0, packageRootDir);
|
||||
@@ -540,7 +540,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
QStringList dirNames;
|
||||
dirNames.append(relativePath.split('/', QString::SkipEmptyParts));
|
||||
dirNames.append(relativePath.split('/', Qt::SkipEmptyParts));
|
||||
// Replace the first one being the package name with the package root dir
|
||||
QString packageRootDir = package.path.mid(package.path.lastIndexOf('/') + 1);
|
||||
dirNames.replace(0, packageRootDir);
|
||||
|
||||
@@ -295,6 +295,15 @@ namespace BlackMisc
|
||||
return dt;
|
||||
}
|
||||
|
||||
QDateTime fromStringUtc(const QString& dateTimeString, const QLocale& locale, QLocale::FormatType format)
|
||||
{
|
||||
if (dateTimeString.isEmpty()) { return QDateTime(); }
|
||||
QDateTime dt = locale.toDateTime(dateTimeString, format);
|
||||
if (!dt.isValid()) { return dt; }
|
||||
dt.setOffsetFromUtc(0); // must only be applied to valid timestamps
|
||||
return dt;
|
||||
}
|
||||
|
||||
QDateTime parseMultipleDateTimeFormats(const QString &dateTimeString)
|
||||
{
|
||||
if (dateTimeString.isEmpty()) { return QDateTime(); }
|
||||
@@ -325,10 +334,10 @@ namespace BlackMisc
|
||||
ts = fromStringUtc(dateTimeString, Qt::TextDate);
|
||||
if (ts.isValid()) return ts;
|
||||
|
||||
ts = fromStringUtc(dateTimeString, Qt::DefaultLocaleLongDate);
|
||||
ts = fromStringUtc(dateTimeString, QLocale(), QLocale::LongFormat);
|
||||
if (ts.isValid()) return ts;
|
||||
|
||||
ts = fromStringUtc(dateTimeString, Qt::DefaultLocaleShortDate);
|
||||
ts = fromStringUtc(dateTimeString, QLocale(), QLocale::ShortFormat);
|
||||
if (ts.isValid()) return ts;
|
||||
|
||||
// SystemLocaleShortDate,
|
||||
|
||||
@@ -286,6 +286,10 @@ namespace BlackMisc
|
||||
//! \remark potentially slow, so only to be used when format is unknown
|
||||
BLACKMISC_EXPORT QDateTime fromStringUtc(const QString &dateTimeString, Qt::DateFormat format = Qt::TextDate);
|
||||
|
||||
//! Same as QDateTime::fromString but QDateTime will be set to UTC
|
||||
//! \remark potentially slow, so only to be used when format is unknown
|
||||
BLACKMISC_EXPORT QDateTime fromStringUtc(const QString &dateTimeString, const QLocale &locale, QLocale::FormatType format);
|
||||
|
||||
//! Parse multiple date time formats
|
||||
//! \remark potentially slow, so only to be used when format is unknown
|
||||
//! \remark TZ is UTC
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace BlackMisc
|
||||
if (!equal)
|
||||
{
|
||||
errors++;
|
||||
if (verbose) { ts << "I: " << in.toQString() << endl << "O: " << out.toQString() << Qt::endl; }
|
||||
if (verbose) { ts << "I: " << in.toQString() << Qt::endl << "O: " << out.toQString() << Qt::endl; }
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user