Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raised the minimum Qt version to 5.15 #4141

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Unreleased

* Raised minimum supported Qt version from 5.12 to 5.15

### Tiled 1.11.1 (11 Jan 2025)

* Releases now ship with support for loading Aseprite images (#4109)
Expand Down
7 changes: 1 addition & 6 deletions dist/distribute.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
2 changes: 1 addition & 1 deletion src/libtiled/libtiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/libtiled/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,15 +743,7 @@ inline bool Map::LayerIteratorHelper::isEmpty() const

inline QList<Layer *> Map::LayerIteratorHelper::toList() const
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return QList<Layer *>(begin(), end());
#else
LayerIterator iterator(&mMap, mLayerTypes);
QList<Layer *> layers;
while (Layer *layer = iterator.next())
layers.append(layer);
return layers;
#endif
}


Expand Down
5 changes: 0 additions & 5 deletions src/libtiled/mapreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/libtiled/minimaprenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ class TILEDSHARED_EXPORT MiniMapRenderer
private:
const Map *mMap;
std::unique_ptr<MapRenderer> mRenderer;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QColor mGridColor = Qt::black;
#else
QColor mGridColor = QColorConstants::Black;
#endif
RenderObjectLabelCallback mRenderObjectLabelCallback;
};

Expand Down
10 changes: 0 additions & 10 deletions src/libtiled/properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions src/libtiled/propertytype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QStringRef> 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<QStringRef> stringValues = stringValue.splitRef(QLatin1Char(','), Qt::SkipEmptyParts);
#else
const QList<QStringView> stringValues = QStringView(stringValue).split(QLatin1Char(','), Qt::SkipEmptyParts);
Expand Down
6 changes: 0 additions & 6 deletions src/libtiled/qtcompat_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@

#include <QTextStream>

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
namespace Qt {
using ::endl;
}
#endif

#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
using QStringRef = QStringView;
#endif
2 changes: 1 addition & 1 deletion src/libtiledquick/libtiledquick.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 0 additions & 4 deletions src/plugins/yy/yyplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 0 additions & 4 deletions src/tiled/brokenlinks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,7 @@ void LinkFixer::tryFixLinks(const QVector<BrokenLink> &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<QString> 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) {
Expand Down
9 changes: 0 additions & 9 deletions src/tiled/clipboardmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
4 changes: 1 addition & 3 deletions src/tiled/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/tiled/commanddatamodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 1 addition & 8 deletions src/tiled/geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,7 @@ static bool isCoherentTo(const QRect &rect, const QRegion &region)
QVector<QRegion> coherentRegions(const QRegion &region)
{
QVector<QRegion> result;
QVector<QRect> rects;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
rects.reserve(static_cast<int>(region.end() - region.begin()));
for (const QRect &rect : region)
rects.append(rect);
#else
rects = QVector<QRect>(region.begin(), region.end());
#endif
QVector<QRect> rects(region.begin(), region.end());

while (!rects.isEmpty()) {
QRegion newCoherentRegion = rects.takeLast();
Expand Down
2 changes: 1 addition & 1 deletion src/tiled/libtilededitor.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 0 additions & 4 deletions src/tiled/locatorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 0 additions & 4 deletions src/tiled/minimap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 0 additions & 4 deletions src/tiled/projectdock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString>(paths.begin(), paths.end());
#endif
}

void ProjectView::addExpandedPath(const QString &path)
Expand Down
4 changes: 0 additions & 4 deletions src/tiled/projectmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Match> findFiles(const QStringList &words) const;
Expand Down
7 changes: 0 additions & 7 deletions src/tiled/propertyeditorwidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/tiled/regionvaluetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,7 @@ QVector<RegionValueType> RegionValueType::contiguousRegions() const

QVector<QRect> RegionValueType::rects() const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QVector<QRect> rects;
rects.reserve(static_cast<int>(mRegion.end() - mRegion.begin()));
for (const QRect &rect : mRegion)
rects.append(rect);
return rects;
#else
return QVector<QRect>(mRegion.begin(), mRegion.end());
#endif
}

} // namespace Tiled
Expand Down
7 changes: 0 additions & 7 deletions src/tiled/scriptdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions src/tiled/scriptfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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<ScriptTextFile>());
globalObject.setProperty(QStringLiteral("BinaryFile"), jsEngine->newQMetaObject<ScriptBinaryFile>());
#endif
}

} // namespace Tiled
Expand Down
6 changes: 0 additions & 6 deletions src/tiled/stylehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
Loading
Loading