Remove unneeded version checks

After we raised the minimum Qt version.

Change-Id: Ife81a25c3c205646eece30d6dd1a95f4b97eda01
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Eike Ziller
2024-02-19 16:23:50 +01:00
parent ff04dc53ef
commit c4e8963d8d
15 changed files with 0 additions and 102 deletions

View File

@@ -10,26 +10,11 @@
#include <QDebug> #include <QDebug>
#include <QJsonObject> #include <QJsonObject>
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
#include <QLatin1StringView> #include <QLatin1StringView>
#else
#include <QLatin1String>
#endif
namespace LanguageServerProtocol { namespace LanguageServerProtocol {
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
using Key = QLatin1StringView; using Key = QLatin1StringView;
#else
class Key : public QLatin1String
{
public:
using QLatin1String::QLatin1String;
constexpr inline explicit Key(const char *s) noexcept
: QLatin1String(s, std::char_traits<char>::length(s))
{}
};
#endif
class LANGUAGESERVERPROTOCOL_EXPORT JsonObject class LANGUAGESERVERPROTOCOL_EXPORT JsonObject
{ {

View File

@@ -464,11 +464,7 @@ bool TimelineItemsMaterialShader::updateUniformData(RenderState &state,
TimelineItemsMaterial::TimelineItemsMaterial() : m_selectedItem(-1) TimelineItemsMaterial::TimelineItemsMaterial() : m_selectedItem(-1)
{ {
setFlag(QSGMaterial::Blending, false); setFlag(QSGMaterial::Blending, false);
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
setFlag(QSGMaterial::NoBatching, true); setFlag(QSGMaterial::NoBatching, true);
#else
setFlag(QSGMaterial::CustomCompileStep, true);
#endif // >= Qt 6.3/6.0
} }
QVector2D TimelineItemsMaterial::scale() const QVector2D TimelineItemsMaterial::scale() const

View File

@@ -152,11 +152,7 @@ TimelineNotesRenderPassState::TimelineNotesRenderPassState(int numExpandedRows)
m_nullGeometry(NotesGeometry::point2DWithDistanceFromTop(), 0) m_nullGeometry(NotesGeometry::point2DWithDistanceFromTop(), 0)
{ {
m_material.setFlag(QSGMaterial::Blending, true); m_material.setFlag(QSGMaterial::Blending, true);
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
m_material.setFlag(QSGMaterial::NoBatching, true); m_material.setFlag(QSGMaterial::NoBatching, true);
#else
m_material.setFlag(QSGMaterial::CustomCompileStep, true);
#endif // >= Qt 6.3
m_expandedRows.reserve(numExpandedRows); m_expandedRows.reserve(numExpandedRows);
for (int i = 0; i < numExpandedRows; ++i) for (int i = 0; i < numExpandedRows; ++i)
m_expandedRows << createNode(); m_expandedRows << createNode();

View File

@@ -17,16 +17,6 @@ public:
} }
}; };
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_idle, (QThread::IdlePriority));
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_lowest, (QThread::LowestPriority));
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_low, (QThread::LowPriority));
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_normal, (QThread::NormalPriority));
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_high, (QThread::HighPriority));
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_highest, (QThread::HighestPriority));
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_timeCritical, (QThread::TimeCriticalPriority));
Q_GLOBAL_STATIC_WITH_ARGS(AsyncThreadPool, s_inherit, (QThread::InheritPriority));
#else
Q_GLOBAL_STATIC(AsyncThreadPool, s_idle, QThread::IdlePriority); Q_GLOBAL_STATIC(AsyncThreadPool, s_idle, QThread::IdlePriority);
Q_GLOBAL_STATIC(AsyncThreadPool, s_lowest, QThread::LowestPriority); Q_GLOBAL_STATIC(AsyncThreadPool, s_lowest, QThread::LowestPriority);
Q_GLOBAL_STATIC(AsyncThreadPool, s_low, QThread::LowPriority); Q_GLOBAL_STATIC(AsyncThreadPool, s_low, QThread::LowPriority);
@@ -35,7 +25,6 @@ Q_GLOBAL_STATIC(AsyncThreadPool, s_high, QThread::HighPriority);
Q_GLOBAL_STATIC(AsyncThreadPool, s_highest, QThread::HighestPriority); Q_GLOBAL_STATIC(AsyncThreadPool, s_highest, QThread::HighestPriority);
Q_GLOBAL_STATIC(AsyncThreadPool, s_timeCritical, QThread::TimeCriticalPriority); Q_GLOBAL_STATIC(AsyncThreadPool, s_timeCritical, QThread::TimeCriticalPriority);
Q_GLOBAL_STATIC(AsyncThreadPool, s_inherit, QThread::InheritPriority); Q_GLOBAL_STATIC(AsyncThreadPool, s_inherit, QThread::InheritPriority);
#endif
QThreadPool *asyncThreadPool(QThread::Priority priority) QThreadPool *asyncThreadPool(QThread::Priority priority)
{ {

View File

@@ -35,11 +35,7 @@ FSEngineImpl::~FSEngineImpl()
delete m_tempStorage; delete m_tempStorage;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
bool FSEngineImpl::open(QIODeviceBase::OpenMode openMode, std::optional<QFile::Permissions>) bool FSEngineImpl::open(QIODeviceBase::OpenMode openMode, std::optional<QFile::Permissions>)
#else
bool FSEngineImpl::open(QIODevice::OpenMode openMode)
#endif
{ {
const FilePathInfoCache::CachedData data = g_filePathInfoCache.cached(m_filePath, const FilePathInfoCache::CachedData data = g_filePathInfoCache.cached(m_filePath,
createCacheData); createCacheData);
@@ -162,12 +158,8 @@ bool FSEngineImpl::link(const QString &newName)
return false; return false;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
bool FSEngineImpl::mkdir(const QString &dirName, bool createParentDirectories, bool FSEngineImpl::mkdir(const QString &dirName, bool createParentDirectories,
std::optional<QFile::Permissions>) const std::optional<QFile::Permissions>) const
#else
bool FSEngineImpl::mkdir(const QString &dirName, bool createParentDirectories) const
#endif
{ {
Q_UNUSED(createParentDirectories) Q_UNUSED(createParentDirectories)
return FilePath::fromString(dirName).createDir(); return FilePath::fromString(dirName).createDir();

View File

@@ -19,15 +19,10 @@ public:
~FSEngineImpl(); ~FSEngineImpl();
public: public:
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
bool open(QIODeviceBase::OpenMode openMode, bool open(QIODeviceBase::OpenMode openMode,
std::optional<QFile::Permissions> permissions = std::nullopt) override; std::optional<QFile::Permissions> permissions = std::nullopt) override;
bool mkdir(const QString &dirName, bool createParentDirectories, bool mkdir(const QString &dirName, bool createParentDirectories,
std::optional<QFile::Permissions> permissions = std::nullopt) const override; std::optional<QFile::Permissions> permissions = std::nullopt) const override;
#else
bool open(QIODevice::OpenMode openMode) override;
bool mkdir(const QString &dirName, bool createParentDirectories) const override;
#endif
bool close() override; bool close() override;
bool flush() override; bool flush() override;
bool syncToDisk() override; bool syncToDisk() override;

View File

@@ -200,12 +200,10 @@ public:
operator SmallStringView() const noexcept { return SmallStringView(data(), size()); } operator SmallStringView() const noexcept { return SmallStringView(data(), size()); }
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
explicit operator QLatin1StringView() const noexcept explicit operator QLatin1StringView() const noexcept
{ {
return QLatin1StringView(data(), Utils::ssize(*this)); return QLatin1StringView(data(), Utils::ssize(*this));
} }
#endif
operator QUtf8StringView() const noexcept operator QUtf8StringView() const noexcept
{ {

View File

@@ -79,12 +79,10 @@ public:
explicit operator QByteArray() const { return QByteArray(data(), int(size())); } explicit operator QByteArray() const { return QByteArray(data(), int(size())); }
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
explicit operator QLatin1StringView() const noexcept explicit operator QLatin1StringView() const noexcept
{ {
return QLatin1StringView(data(), Utils::ssize(*this)); return QLatin1StringView(data(), Utils::ssize(*this));
} }
#endif
operator QUtf8StringView() const noexcept operator QUtf8StringView() const noexcept
{ {

View File

@@ -190,14 +190,6 @@ QRect ManhattanStyle::subControlRect(
SubControl subControl, SubControl subControl,
const QWidget *widget) const const QWidget *widget) const
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 5)
// Workaround for QTBUG-101581, can be removed when building with Qt 6.2.5 or higher
if (control == CC_ScrollBar) {
const auto scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option);
if (scrollbar && qint64(scrollbar->maximum) - scrollbar->minimum > INT_MAX)
return QRect(); // breaks the scrollbar, but avoids the crash
}
#endif
return QProxyStyle::subControlRect(control, option, subControl, widget); return QProxyStyle::subControlRect(control, option, subControl, widget);
} }

View File

@@ -44,14 +44,7 @@ public:
inline static bool isValidColorName(const QString &colorName) inline static bool isValidColorName(const QString &colorName)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
return QColor::isValidColorName(colorName); return QColor::isValidColorName(colorName);
#else
constexpr QStringView colorPattern(
u"(?<color>^(?:#(?:(?:[0-9a-fA-F]{2}){3,4}|(?:[0-9a-fA-F]){3,4}))$)");
static const QRegularExpression colorRegex(colorPattern.toString());
return colorRegex.match(colorName).hasMatch();
#endif // >= Qt 6.4
} }
/** /**

View File

@@ -223,16 +223,8 @@ struct JsonMap<QMap<Key, Value>>
{ {
QJsonObject output; QJsonObject output;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
for (const auto &[key, val] : map.asKeyValueRange()) for (const auto &[key, val] : map.asKeyValueRange())
output[DesignerIconEnums<Key>::toString(key)] = JsonMap<Value>::json(val); output[DesignerIconEnums<Key>::toString(key)] = JsonMap<Value>::json(val);
#else
const auto mapKeys = map.keys();
for (const Key &key : mapKeys) {
const Value &val = map.value(key);
output[DesignerIconEnums<Key>::toString(key)] = JsonMap<Value>::json(val);
}
#endif
return output; return output;
} }
@@ -397,15 +389,9 @@ void DesignerIcons::loadIconSettings(const QString &fileName)
QJsonObject areaPackObject = areaPack.toObject(); QJsonObject areaPackObject = areaPack.toObject();
singleAreaMap = JsonMap<IconsMap>::value(areaPackObject, {}); singleAreaMap = JsonMap<IconsMap>::value(areaPackObject, {});
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
for (const auto &mapItem : singleAreaMap.asKeyValueRange()) { for (const auto &mapItem : singleAreaMap.asKeyValueRange()) {
const IconId &id = mapItem.first; const IconId &id = mapItem.first;
const AreaMap &areaMap = mapItem.second; const AreaMap &areaMap = mapItem.second;
#else
const auto mapKeys = singleAreaMap.keys();
for (const IconId &id : mapKeys) {
const AreaMap &areaMap = singleAreaMap.value(id);
#endif
if (d->icons.contains(id)) { if (d->icons.contains(id)) {
AreaMap &oldAreaMap = d->icons[id]; AreaMap &oldAreaMap = d->icons[id];
for (const auto &areaMapItem : areaMap.asKeyValueRange()) for (const auto &areaMapItem : areaMap.asKeyValueRange())

View File

@@ -973,15 +973,6 @@ QRect StudioStyle::subControlRect(
SubControl subControl, SubControl subControl,
const QWidget *widget) const const QWidget *widget) const
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 5)
// Workaround for QTBUG-101581, can be removed when building with Qt 6.2.5 or higher
if (control == CC_ScrollBar) {
const auto scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option);
if (scrollbar && qint64(scrollbar->maximum) - scrollbar->minimum > INT_MAX)
return QRect(); // breaks the scrollbar, but avoids the crash
}
#endif
switch (control) { switch (control) {
case CC_Slider: { case CC_Slider: {
if (const auto slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { if (const auto slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {

View File

@@ -309,11 +309,7 @@ bool BindingLoopMaterialShader::updateUniformData(RenderState &state, QSGMateria
BindingLoopMaterial::BindingLoopMaterial() BindingLoopMaterial::BindingLoopMaterial()
{ {
setFlag(QSGMaterial::Blending, false); setFlag(QSGMaterial::Blending, false);
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
setFlag(QSGMaterial::NoBatching, true); setFlag(QSGMaterial::NoBatching, true);
#else
setFlag(QSGMaterial::CustomCompileStep, true);
#endif // >= Qt 6.3
} }
QSGMaterialType *BindingLoopMaterial::type() const QSGMaterialType *BindingLoopMaterial::type() const

View File

@@ -33,11 +33,7 @@ void Relayer::setClientSocket(QTcpSocket *clientSocket)
QTC_CHECK(!m_clientSocket); QTC_CHECK(!m_clientSocket);
m_clientSocket = clientSocket; m_clientSocket = clientSocket;
if (m_clientSocket) { if (m_clientSocket) {
#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(m_clientSocket, errorOccurred, this, &Relayer::handleClientHasError); connect(m_clientSocket, errorOccurred, this, &Relayer::handleClientHasError);
connect(m_clientSocket, &QAbstractSocket::disconnected, connect(m_clientSocket, &QAbstractSocket::disconnected,
this, [this](){server()->removeRelayConnection(this);}); this, [this](){server()->removeRelayConnection(this);});

View File

@@ -247,12 +247,7 @@ private slots:
QDirIterator it(m_tempDir->path(), s_filters, QDirIterator::Subdirectories QDirIterator it(m_tempDir->path(), s_filters, QDirIterator::Subdirectories
| QDirIterator::FollowSymlinks); | QDirIterator::FollowSymlinks);
while (it.hasNext()) { while (it.hasNext()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
const QFileInfo fi = it.nextFileInfo(); const QFileInfo fi = it.nextFileInfo();
#else
it.next();
const QFileInfo fi = it.fileInfo();
#endif
if (fi.isDir()) { if (fi.isDir()) {
++dirsCount; ++dirsCount;
} else { } else {