Skip to content

Commit

Permalink
Make sure broken links check runs after reload
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn committed May 17, 2024
1 parent 09e134b commit 0632e38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/tiled/brokenlinks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "brokenlinks.h"

#include "changeevents.h"
#include "changetileimagesource.h"
#include "documentmanager.h"
#include "fileformat.h"
Expand Down Expand Up @@ -133,6 +134,8 @@ void BrokenLinksModel::setDocument(Document *document)
connectToTileset(tilesetDocument->tileset());
}

connect(mDocument, &Document::changed,
this, &BrokenLinksModel::documentChanged);
connect(mDocument, &Document::ignoreBrokenLinksChanged,
this, &BrokenLinksModel::refresh);
}
Expand Down Expand Up @@ -304,6 +307,17 @@ QVariant BrokenLinksModel::headerData(int section, Qt::Orientation orientation,
return QVariant();
}

void BrokenLinksModel::documentChanged(const ChangeEvent &event)
{
switch (event.type) {
case ChangeEvent::DocumentReloaded:
refresh();
break;
default:
break;
}
}

void BrokenLinksModel::tileImageSourceChanged(Tile *tile)
{
auto matchesTile = [tile](const BrokenLink &link) {
Expand Down
2 changes: 2 additions & 0 deletions src/tiled/brokenlinks.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class BrokenLinksModel : public QAbstractListModel
void hasBrokenLinksChanged(bool hasBrokenLinks);

private:
void documentChanged(const ChangeEvent &event);

void tileImageSourceChanged(Tile *tile);
void tilesetChanged(Tileset *tileset);

Expand Down

0 comments on commit 0632e38

Please sign in to comment.