From 4f893c2af09f2a9e3e2eee81af97055e5e8e872b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Sun, 12 Jan 2025 16:30:18 +0100 Subject: [PATCH] Raised the minimum Qt version to 5.15 Even Qt 5.15's "extended lifetime" will end 26th of May 2025. Before we stop supporting Qt 5 entirely, I'm dropping support for all but the last version. Minimum version of macOS supported is now 10.13 rather than 10.12. --- .github/workflows/packages.yml | 6 +++--- dist/distribute.qbs | 7 +------ src/libtiled/libtiled.qbs | 2 +- src/libtiled/map.h | 8 -------- src/libtiled/mapreader.cpp | 5 ----- src/libtiled/minimaprenderer.h | 4 ---- src/libtiled/properties.cpp | 10 --------- src/libtiled/propertytype.cpp | 4 +--- src/libtiledquick/libtiledquick.qbs | 2 +- src/plugins/yy/yyplugin.cpp | 4 ---- src/tiled/brokenlinks.cpp | 4 ---- src/tiled/clipboardmanager.cpp | 9 -------- src/tiled/command.cpp | 4 +--- src/tiled/commanddatamodel.cpp | 4 ---- src/tiled/geometry.cpp | 9 +------- src/tiled/libtilededitor.qbs | 2 +- src/tiled/locatorwidget.cpp | 4 ---- src/tiled/minimap.cpp | 4 ---- src/tiled/projectdock.cpp | 4 ---- src/tiled/projectmodel.h | 4 ---- src/tiled/propertyeditorwidgets.cpp | 7 ------- src/tiled/regionvaluetype.cpp | 8 -------- src/tiled/scriptdialog.cpp | 7 ------- src/tiled/scriptfile.cpp | 7 ------- src/tiled/stylehelper.cpp | 6 ------ src/tiled/tiledproxystyle.cpp | 9 -------- src/tiled/tilesetview.cpp | 4 ---- src/tiled/transformmapobjects.h | 4 ---- src/tiled/utils.cpp | 25 ----------------------- src/tiledapp/main.cpp | 2 -- src/tiledquick/main.cpp | 2 -- src/tiledquick/tiledquick.qbs | 2 +- src/tiledquickplugin/tiledquickplugin.cpp | 4 ---- src/tiledquickplugin/tiledquickplugin.qbs | 2 +- src/tmxviewer/tmxviewer.qbs | 2 +- 35 files changed, 13 insertions(+), 178 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 7b8f342dae..3a911a8204 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -218,9 +218,9 @@ jobs: strategy: matrix: include: - - qt_version: 5.12.12 + - qt_version: 5.15.2 qt_modules: "" - version_suffix: "10.12-10.15" + version_suffix: "10.13-10.15" architectures: x86_64 cmake_architectures: x86_64 - qt_version: 6.8.1 @@ -460,7 +460,7 @@ jobs: Tiled-${{ needs.version.outputs.version }}_Windows-7-8_x86.msi/*.msi Tiled-${{ needs.version.outputs.version }}_Linux_Qt-5_x86_64.AppImage/*.AppImage Tiled-${{ needs.version.outputs.version }}_Linux_Qt-6_x86_64.AppImage/*.AppImage - Tiled-${{ needs.version.outputs.version }}_macOS-10.12-10.15.app/*.zip + Tiled-${{ needs.version.outputs.version }}_macOS-10.13-10.15.app/*.zip Tiled-${{ needs.version.outputs.version }}_macOS-11+.app/*.zip sentry: diff --git a/dist/distribute.qbs b/dist/distribute.qbs index 4cddb10bfc..f08c677d12 100644 --- a/dist/distribute.qbs +++ b/dist/distribute.qbs @@ -43,12 +43,7 @@ Product { return Qt.core.libPath + "/lib" } } - property string postfix: { - var suffix = ""; - if (qbs.targetOS.contains("windows") && qbs.debugInformation && Qt.core.versionMajor < 6 && Qt.core.versionMinor < 15) - suffix += "d"; - return suffix + cpp.dynamicLibrarySuffix; - } + property string postfix: cpp.dynamicLibrarySuffix files: { function addQtVersions(libs) { var result = []; diff --git a/src/libtiled/libtiled.qbs b/src/libtiled/libtiled.qbs index 21e0357e24..f3e72cf4b4 100644 --- a/src/libtiled/libtiled.qbs +++ b/src/libtiled/libtiled.qbs @@ -5,7 +5,7 @@ DynamicLibrary { cpp.dynamicLibraryPrefix: "lib" Depends { name: "cpp" } - Depends { name: "Qt"; submodules: "gui"; versionAtLeast: "5.12" } + Depends { name: "Qt"; submodules: "gui"; versionAtLeast: "5.15" } Probes.PkgConfigProbe { id: pkgConfigZstd diff --git a/src/libtiled/map.h b/src/libtiled/map.h index f353ad72f8..5e4ddd3833 100644 --- a/src/libtiled/map.h +++ b/src/libtiled/map.h @@ -743,15 +743,7 @@ inline bool Map::LayerIteratorHelper::isEmpty() const inline QList Map::LayerIteratorHelper::toList() const { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) return QList(begin(), end()); -#else - LayerIterator iterator(&mMap, mLayerTypes); - QList layers; - while (Layer *layer = iterator.next()) - layers.append(layer); - return layers; -#endif } diff --git a/src/libtiled/mapreader.cpp b/src/libtiled/mapreader.cpp index 820eed8b43..30ff7c1693 100644 --- a/src/libtiled/mapreader.cpp +++ b/src/libtiled/mapreader.cpp @@ -1273,13 +1273,8 @@ QPolygonF MapReaderPrivate::readPolygon() const QXmlStreamAttributes atts = xml.attributes(); const QString points = atts.value(QLatin1String("points")).toString(); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - const QStringList pointsList = points.split(QLatin1Char(' '), - QString::SkipEmptyParts); -#else const QStringList pointsList = points.split(QLatin1Char(' '), Qt::SkipEmptyParts); -#endif QPolygonF polygon; bool ok = true; diff --git a/src/libtiled/minimaprenderer.h b/src/libtiled/minimaprenderer.h index da9340ae71..f7d1d89a73 100644 --- a/src/libtiled/minimaprenderer.h +++ b/src/libtiled/minimaprenderer.h @@ -77,11 +77,7 @@ class TILEDSHARED_EXPORT MiniMapRenderer private: const Map *mMap; std::unique_ptr mRenderer; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QColor mGridColor = Qt::black; -#else QColor mGridColor = QColorConstants::Black; -#endif RenderObjectLabelCallback mRenderObjectLabelCallback; }; diff --git a/src/libtiled/properties.cpp b/src/libtiled/properties.cpp index 7c65e5f36a..d8ab1e536c 100644 --- a/src/libtiled/properties.cpp +++ b/src/libtiled/properties.cpp @@ -125,17 +125,7 @@ void mergeProperties(Properties &target, const Properties &source) return; } -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - // Based on QMap::unite, but using insert instead of insertMulti - Properties::const_iterator it = source.constEnd(); - const Properties::const_iterator b = source.constBegin(); - while (it != b) { - --it; - target.insert(it.key(), it.value()); - } -#else target.insert(source); -#endif } QJsonArray propertiesToJson(const Properties &properties, const ExportContext &context) diff --git a/src/libtiled/propertytype.cpp b/src/libtiled/propertytype.cpp index 5200877d16..b75433fc94 100644 --- a/src/libtiled/propertytype.cpp +++ b/src/libtiled/propertytype.cpp @@ -171,9 +171,7 @@ QVariant EnumPropertyType::toPropertyValue(const QVariant &value, const ExportCo if (valuesAsFlags) { int flags = 0; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - const QVector stringValues = stringValue.splitRef(QLatin1Char(','), QString::SkipEmptyParts); -#elif QT_VERSION < QT_VERSION_CHECK(6,0,0) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) const QVector stringValues = stringValue.splitRef(QLatin1Char(','), Qt::SkipEmptyParts); #else const QList stringValues = QStringView(stringValue).split(QLatin1Char(','), Qt::SkipEmptyParts); diff --git a/src/libtiledquick/libtiledquick.qbs b/src/libtiledquick/libtiledquick.qbs index 055665e25d..2496a3e0c4 100644 --- a/src/libtiledquick/libtiledquick.qbs +++ b/src/libtiledquick/libtiledquick.qbs @@ -4,7 +4,7 @@ DynamicLibrary { Depends { name: "libtiled" } Depends { name: "cpp" } - Depends { name: "Qt"; submodules: ["quick"]; versionAtLeast: "5.12" } + Depends { name: "Qt"; submodules: ["quick"]; versionAtLeast: "5.15" } cpp.cxxLanguageVersion: "c++17" cpp.cxxFlags: { diff --git a/src/plugins/yy/yyplugin.cpp b/src/plugins/yy/yyplugin.cpp index ab32007fbf..46435178f9 100644 --- a/src/plugins/yy/yyplugin.cpp +++ b/src/plugins/yy/yyplugin.cpp @@ -390,11 +390,7 @@ static void writeProperty(JsonWriter &json, static QStringList readTags(const Object *object) { const QString tags = optionalProperty(object, "tags", QString()); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - const QStringList tagList = tags.split(QLatin1Char(','), QString::SkipEmptyParts); -#else const QStringList tagList = tags.split(QLatin1Char(','), Qt::SkipEmptyParts); -#endif return tagList; } diff --git a/src/tiled/brokenlinks.cpp b/src/tiled/brokenlinks.cpp index 2e52379b2d..ef0d8d4b9a 100644 --- a/src/tiled/brokenlinks.cpp +++ b/src/tiled/brokenlinks.cpp @@ -557,11 +557,7 @@ void LinkFixer::tryFixLinks(const QVector &links) const auto entryList = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - const auto files = entryList.toSet(); -#else const QSet files { entryList.begin(), entryList.end() }; -#endif // See if any of the links we're looking for is located in this directory for (const BrokenLink &link : links) { diff --git a/src/tiled/clipboardmanager.cpp b/src/tiled/clipboardmanager.cpp index 51b01b937d..3e89fc01f5 100644 --- a/src/tiled/clipboardmanager.cpp +++ b/src/tiled/clipboardmanager.cpp @@ -108,11 +108,7 @@ Properties ClipboardManager::properties() const const QMimeData *mimeData = mClipboard->mimeData(); const QByteArray data = mimeData->data(QLatin1String(PROPERTIES_MIMETYPE)); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - const QJsonArray array = QJsonDocument::fromBinaryData(data).array(); -#else const QJsonArray array = QCborValue::fromCbor(data).toArray().toJsonArray(); -#endif return propertiesFromJson(array); } @@ -125,12 +121,7 @@ void ClipboardManager::setProperties(const Properties &properties) const QJsonDocument document(propertiesJson); mimeData->setText(QString::fromUtf8(document.toJson())); - -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - mimeData->setData(QLatin1String(PROPERTIES_MIMETYPE), document.toBinaryData()); -#else mimeData->setData(QLatin1String(PROPERTIES_MIMETYPE), QCborArray::fromJsonArray(propertiesJson).toCborValue().toCbor()); -#endif mClipboard->setMimeData(mimeData); } diff --git a/src/tiled/command.cpp b/src/tiled/command.cpp index 333e3a1db6..635107e2b7 100644 --- a/src/tiled/command.cpp +++ b/src/tiled/command.cpp @@ -297,9 +297,7 @@ CommandProcess::CommandProcess(const Command &command, bool inTerminal, bool sho if (!finalWorkingDirectory.trimmed().isEmpty()) setWorkingDirectory(finalWorkingDirectory); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - start(mFinalCommand); -#elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QStringList args = QProcess::splitCommand(mFinalCommand); const QString executable = args.takeFirst(); start(executable, args); diff --git a/src/tiled/commanddatamodel.cpp b/src/tiled/commanddatamodel.cpp index 02c83a47ae..9cb055c13f 100644 --- a/src/tiled/commanddatamodel.cpp +++ b/src/tiled/commanddatamodel.cpp @@ -462,11 +462,7 @@ bool CommandDataModel::move(int commandIndex, int newIndex) if (commandIndex - newIndex == 1 || newIndex - commandIndex == 1) { // Swapping is probably more efficient than removing/inserting -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - qSwap(mCommands[commandIndex], mCommands[newIndex]); -#else mCommands.swapItemsAt(commandIndex, newIndex); -#endif } else { const Command command = mCommands.at(commandIndex); mCommands.removeAt(commandIndex); diff --git a/src/tiled/geometry.cpp b/src/tiled/geometry.cpp index aec3730f51..dcff3915b9 100644 --- a/src/tiled/geometry.cpp +++ b/src/tiled/geometry.cpp @@ -204,14 +204,7 @@ static bool isCoherentTo(const QRect &rect, const QRegion ®ion) QVector coherentRegions(const QRegion ®ion) { QVector result; - QVector rects; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - rects.reserve(static_cast(region.end() - region.begin())); - for (const QRect &rect : region) - rects.append(rect); -#else - rects = QVector(region.begin(), region.end()); -#endif + QVector rects(region.begin(), region.end()); while (!rects.isEmpty()) { QRegion newCoherentRegion = rects.takeLast(); diff --git a/src/tiled/libtilededitor.qbs b/src/tiled/libtilededitor.qbs index a09578dc3d..58229e2893 100644 --- a/src/tiled/libtilededitor.qbs +++ b/src/tiled/libtilededitor.qbs @@ -8,7 +8,7 @@ DynamicLibrary { Depends { name: "libtiled" } Depends { name: "translations" } Depends { name: "qtsingleapplication" } - Depends { name: "Qt"; submodules: ["core", "widgets", "concurrent", "qml", "svg"]; versionAtLeast: "5.12" } + Depends { name: "Qt"; submodules: ["core", "widgets", "concurrent", "qml", "svg"]; versionAtLeast: "5.15" } Depends { name: "Qt.openglwidgets"; condition: Qt.core.versionMajor >= 6; required: false } Depends { name: "Qt.dbus"; condition: qbs.targetOS.contains("linux") && project.dbus; required: false } Depends { name: "Qt.gui-private"; condition: qbs.targetOS.contains("windows") && Qt.core.versionMajor >= 6 } diff --git a/src/tiled/locatorwidget.cpp b/src/tiled/locatorwidget.cpp index 24fa7a1e74..0c6b490f77 100644 --- a/src/tiled/locatorwidget.cpp +++ b/src/tiled/locatorwidget.cpp @@ -321,11 +321,7 @@ void LocatorWidget::setVisible(bool visible) void LocatorWidget::setFilterText(const QString &text) { const QString normalized = QDir::fromNativeSeparators(text); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - const QStringList words = normalized.split(QLatin1Char(' '), QString::SkipEmptyParts); -#else const QStringList words = normalized.split(QLatin1Char(' '), Qt::SkipEmptyParts); -#endif mLocatorSource->setFilterWords(words); diff --git a/src/tiled/minimap.cpp b/src/tiled/minimap.cpp index 70ebcb113b..986c3ac373 100644 --- a/src/tiled/minimap.cpp +++ b/src/tiled/minimap.cpp @@ -214,11 +214,7 @@ void MiniMap::redrawTimeout() void MiniMap::wheelEvent(QWheelEvent *event) { if (event->angleDelta().y()) { -#if QT_VERSION < QT_VERSION_CHECK(5,14,0) - centerViewOnLocalPixel(event->pos(), event->angleDelta().y()); -#else centerViewOnLocalPixel(event->position(), event->angleDelta().y()); -#endif return; } diff --git a/src/tiled/projectdock.cpp b/src/tiled/projectdock.cpp index 34d9207f90..3b6498ed4d 100644 --- a/src/tiled/projectdock.cpp +++ b/src/tiled/projectdock.cpp @@ -234,11 +234,7 @@ void ProjectView::setModel(QAbstractItemModel *model) void ProjectView::setExpandedPaths(const QStringList &paths) { -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - mExpandedPaths = paths.toSet(); -#else mExpandedPaths = QSet(paths.begin(), paths.end()); -#endif } void ProjectView::addExpandedPath(const QString &path) diff --git a/src/tiled/projectmodel.h b/src/tiled/projectmodel.h index dce87d465d..3fa8fde8d3 100644 --- a/src/tiled/projectmodel.h +++ b/src/tiled/projectmodel.h @@ -69,11 +69,7 @@ class ProjectModel : public QAbstractItemModel int offset; QString path; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QStringRef relativePath() const { return path.midRef(offset); } -#else QStringView relativePath() const { return QStringView(path).mid(offset); } -#endif }; QVector findFiles(const QStringList &words) const; diff --git a/src/tiled/propertyeditorwidgets.cpp b/src/tiled/propertyeditorwidgets.cpp index 122b6fdc28..ccf5d42023 100644 --- a/src/tiled/propertyeditorwidgets.cpp +++ b/src/tiled/propertyeditorwidgets.cpp @@ -133,14 +133,7 @@ QSize PairwiseWrappingLayout::minimumSize() const QSize size; size.setWidth(minimumTwoColumnWidth()); size.setHeight(doLayout(QRect(0, 0, size.width(), 0), true)); - -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - const auto margins = contentsMargins(); - return QSize(size.width() + margins.left() + margins.right(), - size.height() + margins.top() + margins.bottom()); -#else return size.grownBy(contentsMargins()); -#endif } int PairwiseWrappingLayout::doLayout(const QRect &rect, bool testOnly) const diff --git a/src/tiled/regionvaluetype.cpp b/src/tiled/regionvaluetype.cpp index eb7284c862..e7a7813a0f 100644 --- a/src/tiled/regionvaluetype.cpp +++ b/src/tiled/regionvaluetype.cpp @@ -65,15 +65,7 @@ QVector RegionValueType::contiguousRegions() const QVector RegionValueType::rects() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QVector rects; - rects.reserve(static_cast(mRegion.end() - mRegion.begin())); - for (const QRect &rect : mRegion) - rects.append(rect); - return rects; -#else return QVector(mRegion.begin(), mRegion.end()); -#endif } } // namespace Tiled diff --git a/src/tiled/scriptdialog.cpp b/src/tiled/scriptdialog.cpp index cd6add5f39..47d51eb27f 100644 --- a/src/tiled/scriptdialog.cpp +++ b/src/tiled/scriptdialog.cpp @@ -60,14 +60,7 @@ ScriptImageWidget::ScriptImageWidget(Tiled::ScriptImage *image, QWidget *parent) ScriptImage *ScriptImageWidget::image() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - if (auto p = pixmap()) - return new ScriptImage(p->toImage()); - else - return nullptr; -#else return new ScriptImage(pixmap().toImage()); -#endif } void ScriptImageWidget::setImage(ScriptImage *image) diff --git a/src/tiled/scriptfile.cpp b/src/tiled/scriptfile.cpp index ee706a8df0..4fd40b61a0 100644 --- a/src/tiled/scriptfile.cpp +++ b/src/tiled/scriptfile.cpp @@ -345,11 +345,7 @@ static bool copyRecursively(const QString &srcFilePath, return false; } #ifdef Q_OS_UNIX -#if QT_VERSION < QT_VERSION_CHECK(5,14,0) - if (srcFileInfo.isSymLink()) { -#else if (srcFileInfo.isSymbolicLink()) { -#endif // For now, disable symlink preserving copying on Windows. // MS did a good job to prevent people from using symlinks - even if they are supported. if (!createSymLink(storedLinkTarget(srcFilePath), tgtFilePath)) { @@ -784,11 +780,8 @@ void registerFile(QJSEngine *jsEngine) { QJSValue globalObject = jsEngine->globalObject(); globalObject.setProperty(QStringLiteral("File"), jsEngine->newQObject(new ScriptFile)); - -#if QT_VERSION >= 0x050800 globalObject.setProperty(QStringLiteral("TextFile"), jsEngine->newQMetaObject()); globalObject.setProperty(QStringLiteral("BinaryFile"), jsEngine->newQMetaObject()); -#endif } } // namespace Tiled diff --git a/src/tiled/stylehelper.cpp b/src/tiled/stylehelper.cpp index 43e4489754..48a55a09c7 100644 --- a/src/tiled/stylehelper.cpp +++ b/src/tiled/stylehelper.cpp @@ -93,9 +93,7 @@ void StyleHelper::initialize() StyleHelper::StyleHelper() : mDefaultStyle(QApplication::style()->objectName()) , mDefaultPalette(QApplication::palette()) -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) , mDefaultShowShortcutsInContextMenus(QGuiApplication::styleHints()->showShortcutsInContextMenus()) -#endif { apply(); applyFont(); @@ -134,11 +132,7 @@ void StyleHelper::apply() break; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) QGuiApplication::styleHints()->setShowShortcutsInContextMenus(showShortcutsInContextMenus); -#else - Q_UNUSED(showShortcutsInContextMenus) -#endif if (QApplication::style()->objectName() != desiredStyle) { QStyle *style; diff --git a/src/tiled/tiledproxystyle.cpp b/src/tiled/tiledproxystyle.cpp index 476bde79b2..0fc4368e05 100644 --- a/src/tiled/tiledproxystyle.cpp +++ b/src/tiled/tiledproxystyle.cpp @@ -20,10 +20,6 @@ #include "tiledproxystyle.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) -#include "utils.h" -#endif - #include #include #include @@ -131,15 +127,10 @@ static const qreal baseDpi = 96; static qreal dpi(const QStyleOption *option) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) // Expect that QStyleOption::QFontMetrics::QFont has the correct DPI set if (option) return option->fontMetrics.fontDpi(); return baseDpi; -#else - Q_UNUSED(option) - return Utils::defaultDpi(); -#endif } static qreal dpiScaled(qreal value, qreal dpi) diff --git a/src/tiled/tilesetview.cpp b/src/tiled/tilesetview.cpp index ac15fce3c2..cfdc3a9a5b 100644 --- a/src/tiled/tilesetview.cpp +++ b/src/tiled/tilesetview.cpp @@ -696,11 +696,7 @@ void TilesetView::wheelEvent(QWheelEvent *event) if ((wheelZoomsByDefault != control) && event->angleDelta().y()) { -#if QT_VERSION < QT_VERSION_CHECK(5,14,0) - const QPointF &viewportPos = event->posF(); -#else const QPointF &viewportPos = event->position(); -#endif const QPointF contentPos(viewportPos.x() + hor->value(), viewportPos.y() + ver->value()); diff --git a/src/tiled/transformmapobjects.h b/src/tiled/transformmapobjects.h index 076f797e0c..af13ca76ca 100644 --- a/src/tiled/transformmapobjects.h +++ b/src/tiled/transformmapobjects.h @@ -30,10 +30,6 @@ class Document; struct TransformState { -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // required by QVector::reallocData - TransformState() = default; -#endif - explicit TransformState(const MapObject *mapObject) : mPosition(mapObject->position()) , mSize(mapObject->size()) diff --git a/src/tiled/utils.cpp b/src/tiled/utils.cpp index 16ca823d37..8f1e98b4cb 100644 --- a/src/tiled/utils.cpp +++ b/src/tiled/utils.cpp @@ -31,9 +31,6 @@ #include #endif #include -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) -#include -#endif #include #include #include @@ -48,9 +45,6 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) -#include -#endif #include #if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0) && QT_VERSION < QT_VERSION_CHECK(6, 5, 1) @@ -113,11 +107,7 @@ QStringList cleanFilterList(const QString &filter) QRegularExpressionMatch match = regexp.match(filter); if (match.hasMatch()) f = match.captured(2); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - return f.split(QLatin1Char(' '), QString::SkipEmptyParts); -#else return f.split(QLatin1Char(' '), Qt::SkipEmptyParts); -#endif } /** @@ -127,25 +117,14 @@ QStringList cleanFilterList(const QString &filter) bool fileNameMatchesNameFilter(const QString &filePath, const QString &nameFilter) { -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - QRegExp rx; - rx.setCaseSensitivity(Qt::CaseInsensitive); - rx.setPatternSyntax(QRegExp::Wildcard); -#else QRegularExpression rx; rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption); -#endif const QStringList filterList = cleanFilterList(nameFilter); const QString fileName = QFileInfo(filePath).fileName(); for (const QString &filter : filterList) { -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - rx.setPattern(filter); - if (rx.exactMatch(fileName)) -#else rx.setPattern(QRegularExpression::wildcardToRegularExpression(filter)); if (rx.match(fileName).hasMatch()) -#endif return true; } return false; @@ -327,15 +306,11 @@ QIcon colorIcon(const QColor &color, QSize size) */ QRect screenRect(const QWidget *widget) { -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - return QApplication::desktop()->availableGeometry(widget); -#else const QPoint center = widget->mapToGlobal(widget->rect().center()); const QScreen *screen = widget->screen()->virtualSiblingAt(center); if (!screen) screen = widget->screen(); return screen->availableGeometry(); -#endif } /** diff --git a/src/tiledapp/main.cpp b/src/tiledapp/main.cpp index fd0cb18e2c..f38fd4e80a 100644 --- a/src/tiledapp/main.cpp +++ b/src/tiledapp/main.cpp @@ -424,14 +424,12 @@ int main(int argc, char *argv[]) } #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor); // High-DPI scaling is always enabled in Qt 6 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif -#endif #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // Enable support for highres images (added in Qt 5.1, but off by default, always enabled in Qt 6) diff --git a/src/tiledquick/main.cpp b/src/tiledquick/main.cpp index e804fa8f9f..775d9a0b1c 100644 --- a/src/tiledquick/main.cpp +++ b/src/tiledquick/main.cpp @@ -12,9 +12,7 @@ int main(int argc, char *argv[]) #endif // We don't need the scaling factor to be rounded -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); -#endif QApplication app(argc, argv); diff --git a/src/tiledquick/tiledquick.qbs b/src/tiledquick/tiledquick.qbs index 4593444134..2d70871d10 100644 --- a/src/tiledquick/tiledquick.qbs +++ b/src/tiledquick/tiledquick.qbs @@ -11,7 +11,7 @@ QtGuiApplication { Depends { name: "Qt" submodules: ["core", "quick", "widgets"] - versionAtLeast: "5.12" + versionAtLeast: "5.15" } Depends { name: "tiledquickplugin" diff --git a/src/tiledquickplugin/tiledquickplugin.cpp b/src/tiledquickplugin/tiledquickplugin.cpp index 2239da364e..823af8f37d 100644 --- a/src/tiledquickplugin/tiledquickplugin.cpp +++ b/src/tiledquickplugin/tiledquickplugin.cpp @@ -32,11 +32,7 @@ void TiledQuickPlugin::registerTypes(const char *uri) { // @uri org.mapeditor.Tiled -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - qmlRegisterType(); -#else qmlRegisterAnonymousType(uri, 1); -#endif qmlRegisterType(uri, 1, 0, "MapLoader"); qmlRegisterType(uri, 1, 0, "MapItem"); diff --git a/src/tiledquickplugin/tiledquickplugin.qbs b/src/tiledquickplugin/tiledquickplugin.qbs index 729a732bb0..d36a76f21a 100644 --- a/src/tiledquickplugin/tiledquickplugin.qbs +++ b/src/tiledquickplugin/tiledquickplugin.qbs @@ -6,7 +6,7 @@ DynamicLibrary { Depends { name: "libtiledquick" } Depends { name: "Qt"; submodules: ["qml", "quick"] - versionAtLeast: "5.12" + versionAtLeast: "5.15" } cpp.cxxLanguageVersion: "c++17" diff --git a/src/tmxviewer/tmxviewer.qbs b/src/tmxviewer/tmxviewer.qbs index 560701b24d..ee53328d9d 100644 --- a/src/tmxviewer/tmxviewer.qbs +++ b/src/tmxviewer/tmxviewer.qbs @@ -2,7 +2,7 @@ TiledQtGuiApplication { name: "tmxviewer" Depends { name: "libtiled" } - Depends { name: "Qt"; submodules: ["widgets"]; versionAtLeast: "5.12" } + Depends { name: "Qt"; submodules: ["widgets"]; versionAtLeast: "5.15" } cpp.includePaths: ["."]