diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-12-16 17:21:38 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-12-17 16:00:31 +0000 |
commit | 73d5deb4169ec71c97e17e451a182b259118661f (patch) | |
tree | 5ef8c81c0bb10d5d4f0d11e4183a180637e595a0 /src | |
parent | 8b77afedbd4468fa57cd0dec48a5e6833365948a (diff) |
Adapt source code to Qt 6
Change-Id: If84e3e4c832c2b3dc39e40be13e989996ab764d1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/app/config/configcommandexecutor.cpp | 5 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/probe.cpp | 5 | ||||
-rw-r--r-- | src/lib/corelib/language/moduleloader.cpp | 1 | ||||
-rw-r--r-- | src/lib/corelib/tools/qttools.h | 19 | ||||
-rw-r--r-- | src/lib/corelib/tools/vsenvironmentdetector.cpp | 5 |
5 files changed, 29 insertions, 6 deletions
diff --git a/src/app/config/configcommandexecutor.cpp b/src/app/config/configcommandexecutor.cpp index 1290ba2f0..f2d9fc59e 100644 --- a/src/app/config/configcommandexecutor.cpp +++ b/src/app/config/configcommandexecutor.cpp @@ -41,8 +41,9 @@ #include "configcommand.h" #include "../shared/logging/consolelogger.h" -#include <tools/settingsrepresentation.h> #include <tools/error.h> +#include <tools/qttools.h> +#include <tools/settingsrepresentation.h> #include <QtCore/qdir.h> #include <QtCore/qfile.h> @@ -131,7 +132,7 @@ void ConfigCommandExecutor::exportSettings(const QString &filename) const auto keys = m_settings->allKeys(m_scope); for (const QString &key : keys) stream << key << ": " << qbs::settingsValueToRepresentation(m_settings->value(key, m_scope)) - << endl; + << Qt::endl; } void ConfigCommandExecutor::importSettings(const QString &filename) diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp index 513008fd3..4c26e8d60 100644 --- a/src/app/qbs-setup-toolchains/probe.cpp +++ b/src/app/qbs-setup-toolchains/probe.cpp @@ -50,6 +50,7 @@ #include <tools/error.h> #include <tools/hostosinfo.h> #include <tools/profile.h> +#include <tools/qttools.h> #include <tools/settings.h> #include <tools/toolchains.h> @@ -137,10 +138,10 @@ void probe(Settings *settings) sdccProbe(settings, profiles); if (profiles.empty()) { - qStderr << Tr::tr("Could not detect any toolchains. No profile created.") << endl; + qStderr << Tr::tr("Could not detect any toolchains. No profile created.") << Qt::endl; } else if (profiles.size() == 1 && settings->defaultProfile().isEmpty()) { const QString profileName = profiles.front().name(); - qStdout << Tr::tr("Making profile '%1' the default.").arg(profileName) << endl; + qStdout << Tr::tr("Making profile '%1' the default.").arg(profileName) << Qt::endl; settings->setValue(QStringLiteral("defaultProfile"), profileName); } } diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index ec7c38197..faf83dde4 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -3771,6 +3771,7 @@ ModuleLoader::ModuleProviderResult ModuleLoader::findModuleProvider(const Qualif const QString searchPathBaseDir = ModuleProviderInfo::outputDirPath(projectBuildDir, name); const QVariant moduleConfig = moduleProviderConfig(product).value(name.toString()); QTextStream stream(&dummyItemFile); + using Qt::endl; stream.setCodec("UTF-8"); stream << "import qbs.FileInfo" << endl; stream << "import qbs.Utilities" << endl; diff --git a/src/lib/corelib/tools/qttools.h b/src/lib/corelib/tools/qttools.h index c3b4d3a9f..04fd7d95e 100644 --- a/src/lib/corelib/tools/qttools.h +++ b/src/lib/corelib/tools/qttools.h @@ -42,6 +42,7 @@ #include <QtCore/qhash.h> #include <QtCore/qstringlist.h> +#include <QtCore/qtextstream.h> #include <functional> @@ -66,8 +67,16 @@ template<typename T1, typename T2> struct hash<std::pair<T1, T2>> } // namespace std QT_BEGIN_NAMESPACE + uint qHash(const QStringList &list); uint qHash(const QProcessEnvironment &env); + +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) +namespace Qt { +inline QTextStream &endl(QTextStream &stream) { return stream << QT_PREPEND_NAMESPACE(endl); } +} // namespace Qt +#endif + QT_END_NAMESPACE namespace qbs { @@ -82,6 +91,16 @@ QSet<T> toSet(const QList<T> &list) #endif } +template<class T> +QList<T> toList(const QSet<T> &set) +{ +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + return set.toList(); +#else + return QList<T>(set.begin(), set.end()); +#endif +} + } // namespace qbs diff --git a/src/lib/corelib/tools/vsenvironmentdetector.cpp b/src/lib/corelib/tools/vsenvironmentdetector.cpp index f8f98e7b7..b2fd7caf5 100644 --- a/src/lib/corelib/tools/vsenvironmentdetector.cpp +++ b/src/lib/corelib/tools/vsenvironmentdetector.cpp @@ -193,13 +193,13 @@ bool VsEnvironmentDetector::startDetection(const std::vector<MSVC *> &compatible static void batClearVars(QTextStream &s, const QStringList &varnames) { for (const QString &varname : varnames) - s << "set " << varname << '=' << endl; + s << "set " << varname << '=' << Qt::endl; } static void batPrintVars(QTextStream &s, const QStringList &varnames) { for (const QString &varname : varnames) - s << "echo " << varname << "=%" << varname << '%' << endl; + s << "echo " << varname << "=%" << varname << '%' << Qt::endl; } static QString vcArchitecture(const MSVC *msvc) @@ -232,6 +232,7 @@ void VsEnvironmentDetector::writeBatchFile(QIODevice *device, const QString &vcv << QStringLiteral("INCLUDE") << QStringLiteral("LIB") << QStringLiteral("WindowsSdkDir") << QStringLiteral("WindowsSDKVersion") << QStringLiteral("VSINSTALLDIR"); QTextStream s(device); + using Qt::endl; s << "@echo off" << endl; for (const MSVC *msvc : msvcs) { s << "echo --" << msvc->architecture << "--" << endl |