forked from qt-creator/qt-creator
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:
@@ -10,26 +10,11 @@
|
||||
#include <QDebug>
|
||||
#include <QJsonObject>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
#include <QLatin1StringView>
|
||||
#else
|
||||
#include <QLatin1String>
|
||||
#endif
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
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
|
||||
{
|
||||
|
@@ -464,11 +464,7 @@ bool TimelineItemsMaterialShader::updateUniformData(RenderState &state,
|
||||
TimelineItemsMaterial::TimelineItemsMaterial() : m_selectedItem(-1)
|
||||
{
|
||||
setFlag(QSGMaterial::Blending, false);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
setFlag(QSGMaterial::NoBatching, true);
|
||||
#else
|
||||
setFlag(QSGMaterial::CustomCompileStep, true);
|
||||
#endif // >= Qt 6.3/6.0
|
||||
}
|
||||
|
||||
QVector2D TimelineItemsMaterial::scale() const
|
||||
|
@@ -152,11 +152,7 @@ TimelineNotesRenderPassState::TimelineNotesRenderPassState(int numExpandedRows)
|
||||
m_nullGeometry(NotesGeometry::point2DWithDistanceFromTop(), 0)
|
||||
{
|
||||
m_material.setFlag(QSGMaterial::Blending, true);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
m_material.setFlag(QSGMaterial::NoBatching, true);
|
||||
#else
|
||||
m_material.setFlag(QSGMaterial::CustomCompileStep, true);
|
||||
#endif // >= Qt 6.3
|
||||
m_expandedRows.reserve(numExpandedRows);
|
||||
for (int i = 0; i < numExpandedRows; ++i)
|
||||
m_expandedRows << createNode();
|
||||
|
@@ -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_lowest, QThread::LowestPriority);
|
||||
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_timeCritical, QThread::TimeCriticalPriority);
|
||||
Q_GLOBAL_STATIC(AsyncThreadPool, s_inherit, QThread::InheritPriority);
|
||||
#endif
|
||||
|
||||
QThreadPool *asyncThreadPool(QThread::Priority priority)
|
||||
{
|
||||
|
@@ -35,11 +35,7 @@ FSEngineImpl::~FSEngineImpl()
|
||||
delete m_tempStorage;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
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,
|
||||
createCacheData);
|
||||
@@ -162,12 +158,8 @@ bool FSEngineImpl::link(const QString &newName)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
bool FSEngineImpl::mkdir(const QString &dirName, bool createParentDirectories,
|
||||
std::optional<QFile::Permissions>) const
|
||||
#else
|
||||
bool FSEngineImpl::mkdir(const QString &dirName, bool createParentDirectories) const
|
||||
#endif
|
||||
{
|
||||
Q_UNUSED(createParentDirectories)
|
||||
return FilePath::fromString(dirName).createDir();
|
||||
|
@@ -19,15 +19,10 @@ public:
|
||||
~FSEngineImpl();
|
||||
|
||||
public:
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
bool open(QIODeviceBase::OpenMode openMode,
|
||||
std::optional<QFile::Permissions> permissions = std::nullopt) override;
|
||||
bool mkdir(const QString &dirName, bool createParentDirectories,
|
||||
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 flush() override;
|
||||
bool syncToDisk() override;
|
||||
|
@@ -200,12 +200,10 @@ public:
|
||||
|
||||
operator SmallStringView() const noexcept { return SmallStringView(data(), size()); }
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
explicit operator QLatin1StringView() const noexcept
|
||||
{
|
||||
return QLatin1StringView(data(), Utils::ssize(*this));
|
||||
}
|
||||
#endif
|
||||
|
||||
operator QUtf8StringView() const noexcept
|
||||
{
|
||||
|
@@ -79,12 +79,10 @@ public:
|
||||
|
||||
explicit operator QByteArray() const { return QByteArray(data(), int(size())); }
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
explicit operator QLatin1StringView() const noexcept
|
||||
{
|
||||
return QLatin1StringView(data(), Utils::ssize(*this));
|
||||
}
|
||||
#endif
|
||||
|
||||
operator QUtf8StringView() const noexcept
|
||||
{
|
||||
|
@@ -190,14 +190,6 @@ QRect ManhattanStyle::subControlRect(
|
||||
SubControl subControl,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -44,14 +44,7 @@ public:
|
||||
|
||||
inline static bool isValidColorName(const QString &colorName)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -223,16 +223,8 @@ struct JsonMap<QMap<Key, Value>>
|
||||
{
|
||||
QJsonObject output;
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||
for (const auto &[key, val] : map.asKeyValueRange())
|
||||
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;
|
||||
}
|
||||
@@ -397,15 +389,9 @@ void DesignerIcons::loadIconSettings(const QString &fileName)
|
||||
QJsonObject areaPackObject = areaPack.toObject();
|
||||
singleAreaMap = JsonMap<IconsMap>::value(areaPackObject, {});
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||
for (const auto &mapItem : singleAreaMap.asKeyValueRange()) {
|
||||
const IconId &id = mapItem.first;
|
||||
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)) {
|
||||
AreaMap &oldAreaMap = d->icons[id];
|
||||
for (const auto &areaMapItem : areaMap.asKeyValueRange())
|
||||
|
@@ -973,15 +973,6 @@ QRect StudioStyle::subControlRect(
|
||||
SubControl subControl,
|
||||
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) {
|
||||
case CC_Slider: {
|
||||
if (const auto slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
|
||||
|
@@ -309,11 +309,7 @@ bool BindingLoopMaterialShader::updateUniformData(RenderState &state, QSGMateria
|
||||
BindingLoopMaterial::BindingLoopMaterial()
|
||||
{
|
||||
setFlag(QSGMaterial::Blending, false);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
setFlag(QSGMaterial::NoBatching, true);
|
||||
#else
|
||||
setFlag(QSGMaterial::CustomCompileStep, true);
|
||||
#endif // >= Qt 6.3
|
||||
}
|
||||
|
||||
QSGMaterialType *BindingLoopMaterial::type() const
|
||||
|
@@ -33,11 +33,7 @@ void Relayer::setClientSocket(QTcpSocket *clientSocket)
|
||||
QTC_CHECK(!m_clientSocket);
|
||||
m_clientSocket = 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;
|
||||
#endif
|
||||
connect(m_clientSocket, errorOccurred, this, &Relayer::handleClientHasError);
|
||||
connect(m_clientSocket, &QAbstractSocket::disconnected,
|
||||
this, [this](){server()->removeRelayConnection(this);});
|
||||
|
@@ -247,12 +247,7 @@ private slots:
|
||||
QDirIterator it(m_tempDir->path(), s_filters, QDirIterator::Subdirectories
|
||||
| QDirIterator::FollowSymlinks);
|
||||
while (it.hasNext()) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
const QFileInfo fi = it.nextFileInfo();
|
||||
#else
|
||||
it.next();
|
||||
const QFileInfo fi = it.fileInfo();
|
||||
#endif
|
||||
if (fi.isDir()) {
|
||||
++dirsCount;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user