Skip to content

Commit

Permalink
Fixed compilation against Qt 5
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn committed Jul 14, 2024
1 parent f13393d commit 1cb3583
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libtiled/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class TILEDSHARED_EXPORT ObjectRef
Q_PROPERTY(int id MEMBER id)

public:
int id;
int id = 0;

bool operator==(const ObjectRef &o) const
{ return id == o.id; }
Expand Down
5 changes: 5 additions & 0 deletions src/tiled/custompropertieshelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,12 @@ void CustomPropertiesHelper::onValueChanged(QtProperty *property, const QVariant
}
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
subProperties.resize(values.size(), nullptr);
#else
while (subProperties.size() < values.size())
subProperties.append(nullptr);
#endif

// Set sub-property values, creating them if necessary
for (int i = 0; i < values.size(); ++i) {
Expand Down
4 changes: 4 additions & 0 deletions src/tiled/listedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ void ListEdit::addButtonClicked()
if (mValue.isEmpty())
return mAddButton->showMenu();

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
mValue.append(QVariant(mValue.last().metaType()));
#else
mValue.append(QVariant(mValue.last().userType(), nullptr));
#endif
emit valueChanged(mValue);
}

Expand Down
1 change: 1 addition & 0 deletions src/tiled/listedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QWidget>

class QLabel;
class QMenu;
class QToolButton;

namespace Tiled {
Expand Down

0 comments on commit 1cb3583

Please sign in to comment.