Skip to content

Commit

Permalink
Fix span refresh in dynamic view
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Feb 7, 2025
1 parent a04571f commit 24c208a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tiled/tilesetview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void TilesetView::setTilesetDocument(TilesetDocument *tilesetDocument)
connect(mTilesetDocument, &Document::changed, this, &TilesetView::onChange);
connect(mTilesetDocument, &TilesetDocument::tilesAdded, this, &TilesetView::refreshColumnCount);
connect(mTilesetDocument, &TilesetDocument::tilesRemoved, this, &TilesetView::refreshColumnCount);
connect(mTilesetDocument, &TilesetDocument::tileImageSourceChanged, this, &TilesetView::updateAtlasSpans);
connect(mTilesetDocument, &TilesetDocument::tileImageSourceChanged, this, &TilesetView::refreshColumnCount);
}
}

Expand Down Expand Up @@ -431,7 +431,6 @@ void TilesetView::setModel(QAbstractItemModel *model)
{
QTableView::setModel(model);

updateAtlasSpans();
updateBackgroundColor();
setVerticalScrollBarPolicy(dynamicWrapping() ? Qt::ScrollBarAlwaysOn
: Qt::ScrollBarAsNeeded);
Expand Down Expand Up @@ -927,6 +926,7 @@ void TilesetView::refreshColumnCount()

if (!dynamicWrapping()) {
tilesetModel()->setColumnCountOverride(0);
updateAtlasSpans();
return;
}

Expand All @@ -936,6 +936,7 @@ void TilesetView::refreshColumnCount()
const int scaledTileSize = std::max<int>(tileWidth * scale(), 1) + gridSpace;
const int columnCount = std::max(maxSize.width() / scaledTileSize, 1);
tilesetModel()->setColumnCountOverride(columnCount);
updateAtlasSpans();
}

void TilesetView::applyWangId()
Expand Down Expand Up @@ -1084,7 +1085,6 @@ void TilesetView::handleAtlasMouseReleaseEvent(QMouseEvent *event)
}

selectionModel()->clear();
updateAtlasSpans();
}

void TilesetView::mergeSpan(int minRow, int maxRow, int minCol, int maxCol)
Expand Down

0 comments on commit 24c208a

Please sign in to comment.