Fix Tileset Editor changes being missed

This commit is contained in:
GriffinR 2025-08-06 19:53:43 -04:00
parent a4a30ae3c8
commit 5174dcb6eb
3 changed files with 9 additions and 1 deletions

View File

@ -41,11 +41,13 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
- Fix events being dragged in negative coordinates lagging behind the cursor.
- Fix the shortcut for duplicating events working while on the Connections tab.
- Fix the Shortcuts Editor displaying the duplicate shortcut prompt repeatedly.
- Fix clear text button on the left in each row of the Shortcuts Editor also clearing the shortcut on the right.
- Fix the clear text button on the left in each row of the Shortcuts Editor also clearing the shortcut on the right.
- Fix Undo/Redo ignoring the automatic resizing that occurs if a layout/border was an unexpected size.
- Fix Undo/Redo in the Tileset and Palette Editors and Paste in the Tileset Editor appearing enabled even when they don't do anything.
- Fix `Ctrl+Shift+Z` not being set as a default shortcut for Redo in the Palette Editor like it is for other windows.
- Fix the Tileset Editor's status bar not updating while selecting tiles in the metatile layer view.
- Fix cleared metatile labels not updating until the project is reloaded.
- Fix some changes in the Tileset Editor being discarded if the window is closed too quickly.
- Fix the Region Map Editor incorrectly displaying whether a `MAPSEC` has region map data.
- Fix the Primary/Secondary Tileset selectors allowing invalid text, and considering a map unsaved if changed to invalid text then back again.
- Fix broken error message for the primary tileset on the new map/layout dialogs.

View File

@ -1701,6 +1701,7 @@ void Project::loadTilesetMetatileLabels(Tileset* tileset) {
QString metatileLabelPrefix = tileset->getMetatileLabelPrefix();
// Reverse map for faster lookup by metatile id
tileset->metatileLabels.clear();
for (auto it = this->metatileLabelsMap[tileset->name].constBegin(); it != this->metatileLabelsMap[tileset->name].constEnd(); it++) {
QString labelName = it.key();
tileset->metatileLabels[it.value()] = labelName.replace(metatileLabelPrefix, "");

View File

@ -840,6 +840,11 @@ void TilesetEditor::importTilesetTiles(Tileset *tileset) {
void TilesetEditor::closeEvent(QCloseEvent *event)
{
// If focus is still on any input widgets, a user may have made changes
// but the widget hasn't had a chance to fire the 'editingFinished' signal.
// Make sure they lose focus before we close so that changes aren't missed.
setFocus();
if (this->hasUnsavedChanges) {
auto result = SaveChangesMessage::show(QStringLiteral("Tileset"), this);
if (result == QMessageBox::Yes) {