Remove outdated code

Change-Id: I65e0ed79dabd987bc67d4082969835d52dd7cb8b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Robert Löhning
2022-03-07 23:35:26 +01:00
parent 34ecdc3008
commit 7c942cfd18
15 changed files with 5 additions and 104 deletions

View File

@@ -289,12 +289,6 @@ static void setHighDpiEnvironmentVariable()
&& !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) { && !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#if QT_VERSION == QT_VERSION_CHECK(5, 14, 0)
// work around QTBUG-80934
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::Round);
#endif
#endif #endif
} else { } else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@@ -161,13 +161,9 @@ QHash<int, QByteArray> WorkspaceModel::roleNames() const
{LastWorkspaceRole, "activeWorkspace"}, {LastWorkspaceRole, "activeWorkspace"},
{ActiveWorkspaceRole, "lastWorkspace"}}; {ActiveWorkspaceRole, "lastWorkspace"}};
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
auto defaultRoles = QAbstractTableModel::roleNames(); auto defaultRoles = QAbstractTableModel::roleNames();
defaultRoles.insert(extraRoles); defaultRoles.insert(extraRoles);
return defaultRoles; return defaultRoles;
#else
return QAbstractTableModel::roleNames().unite(extraRoles);
#endif
} }
void WorkspaceModel::sort(int column, Qt::SortOrder order) void WorkspaceModel::sort(int column, Qt::SortOrder order)

View File

@@ -327,15 +327,8 @@ void ConnectionClient::connectStandardOutputAndError(QtcProcess *process) const
void ConnectionClient::connectLocalSocketError() const void ConnectionClient::connectLocalSocketError() const
{ {
void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
= &QLocalSocket::error;
#else
= &QLocalSocket::errorOccurred;
#endif
connect(m_localSocket, connect(m_localSocket,
LocalSocketErrorFunction, &QLocalSocket::errorOccurred,
this, this,
&ConnectionClient::printLocalSocketError); &ConnectionClient::printLocalSocketError);
} }

View File

@@ -81,15 +81,8 @@ public:
private: private:
void connectToLocalServer(const QString &connectionName) void connectToLocalServer(const QString &connectionName)
{ {
void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
= &QLocalSocket::error;
#else
= &QLocalSocket::errorOccurred;
#endif
QObject::connect(&m_localSocket, QObject::connect(&m_localSocket,
LocalSocketErrorFunction, &QLocalSocket::errorOccurred,
[&] (QLocalSocket::LocalSocketError) { [&] (QLocalSocket::LocalSocketError) {
qWarning() << "ConnectionServer error:" << m_localSocket.errorString() << connectionName; qWarning() << "ConnectionServer error:" << m_localSocket.errorString() << connectionName;
}); });

View File

@@ -347,11 +347,7 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
emit logStateChange(socketStateToString(state)); emit logStateChange(socketStateToString(state));
}); });
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const auto errorOccurred = QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error);
#else
const auto errorOccurred = &QAbstractSocket::errorOccurred; const auto errorOccurred = &QAbstractSocket::errorOccurred;
#endif
connect(socket, errorOccurred, this, [this](QAbstractSocket::SocketError error) { connect(socket, errorOccurred, this, [this](QAbstractSocket::SocketError error) {
emit logError(socketErrorToString(error)); emit logError(socketErrorToString(error));
socketDisconnected(); socketDisconnected();
@@ -392,14 +388,7 @@ void QmlDebugConnection::newConnection()
connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected, connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected,
Qt::QueuedConnection); Qt::QueuedConnection);
void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError) connect(socket, &QLocalSocket::errorOccurred, this, [this](QLocalSocket::LocalSocketError error) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
= &QLocalSocket::error;
#else
= &QLocalSocket::errorOccurred;
#endif
connect(socket, LocalSocketErrorFunction, this, [this](QLocalSocket::LocalSocketError error) {
emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error))); emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error)));
socketDisconnected(); socketDisconnected();
}, Qt::QueuedConnection); }, Qt::QueuedConnection);

View File

@@ -1303,11 +1303,7 @@ QList<T> toList(const QSet<T> &set)
template <class Key, class T> template <class Key, class T>
void addToHash(QHash<Key, T> *result, const QHash<Key, T> &additionalContents) void addToHash(QHash<Key, T> *result, const QHash<Key, T> &additionalContents)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
result->unite(additionalContents);
#else
result->insert(additionalContents); result->insert(additionalContents);
#endif
} }
} // namespace Utils } // namespace Utils

View File

@@ -670,13 +670,7 @@ bool ProcessArgs::prepareCommand(const CommandLine &cmdLine, QString *outCmd, Pr
} else { } else {
if (err != ProcessArgs::FoundMeta) if (err != ProcessArgs::FoundMeta)
return false; return false;
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
*outCmd = qEnvironmentVariable("SHELL", "/bin/sh"); *outCmd = qEnvironmentVariable("SHELL", "/bin/sh");
#else
// for sdktool
*outCmd = qEnvironmentVariableIsSet("SHELL") ? QString::fromLocal8Bit(qgetenv("SHELL"))
: QString("/bin/sh");
#endif
*outArgs = ProcessArgs::createUnixArgs({"-c", quoteArg(executable.toString()) + ' ' + arguments}); *outArgs = ProcessArgs::createUnixArgs({"-c", quoteArg(executable.toString()) + ' ' + arguments});
} }
} }

View File

@@ -817,11 +817,7 @@ void LauncherSocket::setSocket(QLocalSocket *socket)
m_socket.store(socket); m_socket.store(socket);
m_packetParser.setDevice(m_socket); m_packetParser.setDevice(m_socket);
connect(m_socket, connect(m_socket,
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
static_cast<void(QLocalSocket::*)(QLocalSocket::LocalSocketError)>(&QLocalSocket::error),
#else
&QLocalSocket::errorOccurred, &QLocalSocket::errorOccurred,
#endif
this, &LauncherSocket::handleSocketError); this, &LauncherSocket::handleSocketError);
connect(m_socket, &QLocalSocket::readyRead, connect(m_socket, &QLocalSocket::readyRead,
this, &LauncherSocket::handleSocketDataAvailable); this, &LauncherSocket::handleSocketDataAvailable);

View File

@@ -34,12 +34,7 @@
namespace Utils { namespace Utils {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
// Keep the support code for lower Qt versions for sdktool
constexpr QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts;
#else
constexpr Qt::SplitBehaviorFlags SkipEmptyParts = Qt::SkipEmptyParts; constexpr Qt::SplitBehaviorFlags SkipEmptyParts = Qt::SkipEmptyParts;
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
using QHashValueType = uint; using QHashValueType = uint;
@@ -71,7 +66,6 @@ inline StringView make_stringview(const QString &s)
#endif #endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
// QStringView::mid in Qt5 does not do bounds checking, in Qt6 it does // QStringView::mid in Qt5 does not do bounds checking, in Qt6 it does
inline QStringView midView(const QString &s, int offset, int length) inline QStringView midView(const QString &s, int offset, int length)
{ {
@@ -92,7 +86,6 @@ inline QStringView midView(const QString &s, int offset, int length)
return QStringView(s).mid(offset, length); return QStringView(s).mid(offset, length);
#endif #endif
} }
#endif
#ifdef QT_GUI_LIB #ifdef QT_GUI_LIB
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

View File

@@ -400,9 +400,6 @@ QString formatElapsedTime(qint64 elapsed)
*/ */
QString wildcardToRegularExpression(const QString &original) QString wildcardToRegularExpression(const QString &original)
{ {
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
using qsizetype = int;
#endif
const qsizetype wclen = original.size(); const qsizetype wclen = original.size();
QString rx; QString rx;
rx.reserve(wclen + wclen / 16); rx.reserve(wclen + wclen / 16);
@@ -459,11 +456,7 @@ QString wildcardToRegularExpression(const QString &original)
} }
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
return QRegularExpression::anchoredPattern(rx); return QRegularExpression::anchoredPattern(rx);
#else
return "\\A" + rx + "\\z";
#endif
} }
QTCREATOR_UTILS_EXPORT QString languageNameFromLanguageCode(const QString &languageCode) QTCREATOR_UTILS_EXPORT QString languageNameFromLanguageCode(const QString &languageCode)

View File

@@ -62,17 +62,10 @@ void QdbWatcher::start(RequestType requestType)
void QdbWatcher::startPrivate() void QdbWatcher::startPrivate()
{ {
void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
= &QLocalSocket::error;
#else
= &QLocalSocket::errorOccurred;
#endif
m_socket = std::unique_ptr<QLocalSocket>(new QLocalSocket()); m_socket = std::unique_ptr<QLocalSocket>(new QLocalSocket());
connect(m_socket.get(), &QLocalSocket::connected, connect(m_socket.get(), &QLocalSocket::connected,
this, &QdbWatcher::handleWatchConnection); this, &QdbWatcher::handleWatchConnection);
connect(m_socket.get(), LocalSocketErrorFunction, connect(m_socket.get(), &QLocalSocket::errorOccurred,
this, &QdbWatcher::handleWatchError); this, &QdbWatcher::handleWatchError);
m_socket->connectToServer(qdbSocketName); m_socket->connectToServer(qdbSocketName);
} }

View File

@@ -698,13 +698,8 @@ void FakeVimExCommandsPage::apply()
} }
settings->endArray(); settings->endArray();
globalCommandMapping.clear(); globalCommandMapping.clear();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
globalCommandMapping.insert(defaultMap); globalCommandMapping.insert(defaultMap);
globalCommandMapping.insert(newMapping); globalCommandMapping.insert(newMapping);
#else
globalCommandMapping.unite(defaultMap);
globalCommandMapping.unite(newMapping);
#endif
} }
} }
@@ -956,13 +951,8 @@ void FakeVimUserCommandsPage::apply()
} }
settings->endArray(); settings->endArray();
userMap.clear(); userMap.clear();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
userMap.insert(dd->m_defaultUserCommandMap); userMap.insert(dd->m_defaultUserCommandMap);
userMap.insert(current); userMap.insert(current);
#else
userMap.unite(dd->m_defaultUserCommandMap);
userMap.unite(current);
#endif
} }
} }

View File

@@ -247,18 +247,8 @@ QVariant JsonWizardFactory::mergeDataValueMaps(const QVariant &valueMap, const Q
{ {
QVariantMap retVal; QVariantMap retVal;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QVariantMap &map = defaultValueMap.toMap();
for (auto it = map.begin(), end = map.end(); it != end; ++it)
retVal.insert(it.key(), it.value());
const QVariantMap &map2 = valueMap.toMap();
for (auto it = map2.begin(), end = map2.end(); it != end; ++it)
retVal.insert(it.key(), it.value());
#else
retVal.insert(defaultValueMap.toMap()); retVal.insert(defaultValueMap.toMap());
retVal.insert(valueMap.toMap()); retVal.insert(valueMap.toMap());
#endif
return retVal; return retVal;
} }

View File

@@ -272,12 +272,7 @@ bool DesignerExternalEditor::startEditor(const Utils::FilePath &filePath, QStrin
m_processCache.insert(binary, socket); m_processCache.insert(binary, socket);
auto mapSlot = [this, binary] { processTerminated(binary); }; auto mapSlot = [this, binary] { processTerminated(binary); };
connect(socket, &QAbstractSocket::disconnected, this, mapSlot); connect(socket, &QAbstractSocket::disconnected, this, mapSlot);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) connect(socket, &QAbstractSocket::errorOccurred, this, mapSlot);
const auto errorOccurred = QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error);
#else
const auto errorOccurred = &QAbstractSocket::errorOccurred;
#endif
connect(socket, errorOccurred, this, mapSlot);
} }
return true; return true;
} }

View File

@@ -74,11 +74,7 @@ void LauncherSocketHandler::start()
this, &LauncherSocketHandler::handleSocketClosed); this, &LauncherSocketHandler::handleSocketClosed);
connect(m_socket, &QLocalSocket::readyRead, this, &LauncherSocketHandler::handleSocketData); connect(m_socket, &QLocalSocket::readyRead, this, &LauncherSocketHandler::handleSocketData);
connect(m_socket, connect(m_socket,
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
static_cast<void(QLocalSocket::*)(QLocalSocket::LocalSocketError)>(&QLocalSocket::error),
#else
&QLocalSocket::errorOccurred, &QLocalSocket::errorOccurred,
#endif
this, &LauncherSocketHandler::handleSocketError); this, &LauncherSocketHandler::handleSocketError);
m_socket->connectToServer(m_serverPath); m_socket->connectToServer(m_serverPath);
} }