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")) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
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
} else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@@ -161,13 +161,9 @@ QHash<int, QByteArray> WorkspaceModel::roleNames() const
{LastWorkspaceRole, "activeWorkspace"},
{ActiveWorkspaceRole, "lastWorkspace"}};
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
auto defaultRoles = QAbstractTableModel::roleNames();
defaultRoles.insert(extraRoles);
return defaultRoles;
#else
return QAbstractTableModel::roleNames().unite(extraRoles);
#endif
}
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 (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
= &QLocalSocket::error;
#else
= &QLocalSocket::errorOccurred;
#endif
connect(m_localSocket,
LocalSocketErrorFunction,
&QLocalSocket::errorOccurred,
this,
&ConnectionClient::printLocalSocketError);
}

View File

@@ -81,15 +81,8 @@ public:
private:
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,
LocalSocketErrorFunction,
&QLocalSocket::errorOccurred,
[&] (QLocalSocket::LocalSocketError) {
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));
});
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const auto errorOccurred = QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error);
#else
const auto errorOccurred = &QAbstractSocket::errorOccurred;
#endif
connect(socket, errorOccurred, this, [this](QAbstractSocket::SocketError error) {
emit logError(socketErrorToString(error));
socketDisconnected();
@@ -392,14 +388,7 @@ void QmlDebugConnection::newConnection()
connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected,
Qt::QueuedConnection);
void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
= &QLocalSocket::error;
#else
= &QLocalSocket::errorOccurred;
#endif
connect(socket, LocalSocketErrorFunction, this, [this](QLocalSocket::LocalSocketError error) {
connect(socket, &QLocalSocket::errorOccurred, this, [this](QLocalSocket::LocalSocketError error) {
emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error)));
socketDisconnected();
}, Qt::QueuedConnection);

View File

@@ -1303,11 +1303,7 @@ QList<T> toList(const QSet<T> &set)
template <class Key, class T>
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);
#endif
}
} // namespace Utils

View File

@@ -670,13 +670,7 @@ bool ProcessArgs::prepareCommand(const CommandLine &cmdLine, QString *outCmd, Pr
} else {
if (err != ProcessArgs::FoundMeta)
return false;
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
*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});
}
}

View File

@@ -817,11 +817,7 @@ void LauncherSocket::setSocket(QLocalSocket *socket)
m_socket.store(socket);
m_packetParser.setDevice(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,
#endif
this, &LauncherSocket::handleSocketError);
connect(m_socket, &QLocalSocket::readyRead,
this, &LauncherSocket::handleSocketDataAvailable);

View File

@@ -34,12 +34,7 @@
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;
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
using QHashValueType = uint;
@@ -71,7 +66,6 @@ inline StringView make_stringview(const QString &s)
#endif
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
// QStringView::mid in Qt5 does not do bounds checking, in Qt6 it does
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);
#endif
}
#endif
#ifdef QT_GUI_LIB
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

View File

@@ -400,9 +400,6 @@ QString formatElapsedTime(qint64 elapsed)
*/
QString wildcardToRegularExpression(const QString &original)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
using qsizetype = int;
#endif
const qsizetype wclen = original.size();
QString rx;
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);
#else
return "\\A" + rx + "\\z";
#endif
}
QTCREATOR_UTILS_EXPORT QString languageNameFromLanguageCode(const QString &languageCode)

View File

@@ -62,17 +62,10 @@ void QdbWatcher::start(RequestType requestType)
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());
connect(m_socket.get(), &QLocalSocket::connected,
this, &QdbWatcher::handleWatchConnection);
connect(m_socket.get(), LocalSocketErrorFunction,
connect(m_socket.get(), &QLocalSocket::errorOccurred,
this, &QdbWatcher::handleWatchError);
m_socket->connectToServer(qdbSocketName);
}

View File

@@ -698,13 +698,8 @@ void FakeVimExCommandsPage::apply()
}
settings->endArray();
globalCommandMapping.clear();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
globalCommandMapping.insert(defaultMap);
globalCommandMapping.insert(newMapping);
#else
globalCommandMapping.unite(defaultMap);
globalCommandMapping.unite(newMapping);
#endif
}
}
@@ -956,13 +951,8 @@ void FakeVimUserCommandsPage::apply()
}
settings->endArray();
userMap.clear();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
userMap.insert(dd->m_defaultUserCommandMap);
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;
#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(valueMap.toMap());
#endif
return retVal;
}

View File

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

View File

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