Skip to content

Commit

Permalink
Implemented Tile, WangSet and WangColor properties
Browse files Browse the repository at this point in the history
Now all built-in properties are present, apart from some loose ends.

* Added RectEdit / RectEditorFactory (QRect values)
* Added Property::toolTip (set on label and editor, but currently not
  functional on label due to the eliding tool tip logic)
* Added change events to fix updating of WangSet and WangColor properties
  (was already broken with old framework)
  • Loading branch information
bjorn committed Sep 6, 2024
1 parent 1ce8d98 commit 8153799
Show file tree
Hide file tree
Showing 14 changed files with 530 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/libtiled/wangset.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,5 +424,6 @@ TILEDSHARED_EXPORT WangSet::Type wangSetTypeFromString(const QString &);

} // namespace Tiled

Q_DECLARE_METATYPE(Tiled::WangSet*)
Q_DECLARE_METATYPE(Tiled::WangId)
Q_DECLARE_METATYPE(Tiled::WangSet*)
Q_DECLARE_METATYPE(Tiled::WangSet::Type)
32 changes: 28 additions & 4 deletions src/tiled/changeevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class ChangeEvent
WangSetRemoved,
WangSetChanged,
WangColorAboutToBeRemoved,
WangColorChanged,
} type;

protected:
Expand Down Expand Up @@ -277,17 +278,20 @@ class WangSetChangeEvent : public ChangeEvent
{
public:
enum WangSetProperty {
TypeProperty = 1 << 0,
NameProperty,
TypeProperty,
ImageProperty,
ColorCountProperty,
};

WangSetChangeEvent(WangSet *wangSet, int properties)
WangSetChangeEvent(WangSet *wangSet, WangSetProperty property)
: ChangeEvent(WangSetChanged)
, wangSet(wangSet)
, properties(properties)
, property(property)
{}

WangSet *wangSet;
int properties;
WangSetProperty property;
};

class WangColorEvent : public ChangeEvent
Expand All @@ -303,4 +307,24 @@ class WangColorEvent : public ChangeEvent
int color;
};

class WangColorChangeEvent : public ChangeEvent
{
public:
enum WangColorProperty {
NameProperty,
ColorProperty,
ImageProperty,
ProbabilityProperty,
};

WangColorChangeEvent(WangColor *wangColor, WangColorProperty property)
: ChangeEvent(WangColorChanged)
, wangColor(wangColor)
, property(property)
{}

WangColor *wangColor;
WangColorProperty property;
};

} // namespace Tiled
1 change: 1 addition & 0 deletions src/tiled/colorbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void ColorButton::pickColor()

void ColorButton::updateIcon()
{
// todo: fix gray icon in disabled state (consider using opacity, and not using an icon at all)
setIcon(Utils::colorIcon(mColor, iconSize()));
}

Expand Down
Loading

0 comments on commit 8153799

Please sign in to comment.