Fix metatile label bug while saving
The metatile label only saved when the text field lost focus. But saving doesn't cause the lineEdit to lose focus. This forces a check whenever the tileset is saved.
This commit is contained in:
parent
6b661db952
commit
03186e4591
2 changed files with 12 additions and 0 deletions
|
@ -95,6 +95,7 @@ private:
|
||||||
void importTilesetTiles(Tileset*, bool);
|
void importTilesetTiles(Tileset*, bool);
|
||||||
void importTilesetMetatiles(Tileset*, bool);
|
void importTilesetMetatiles(Tileset*, bool);
|
||||||
void refresh();
|
void refresh();
|
||||||
|
void saveMetatileLabel();
|
||||||
Ui::TilesetEditor *ui;
|
Ui::TilesetEditor *ui;
|
||||||
History<MetatileHistoryItem*> metatileHistory;
|
History<MetatileHistoryItem*> metatileHistory;
|
||||||
TilesetEditorMetatileSelector *metatileSelector = nullptr;
|
TilesetEditorMetatileSelector *metatileSelector = nullptr;
|
||||||
|
|
|
@ -318,6 +318,11 @@ void TilesetEditor::on_comboBox_metatileBehaviors_activated(const QString &metat
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilesetEditor::on_lineEdit_metatileLabel_editingFinished()
|
void TilesetEditor::on_lineEdit_metatileLabel_editingFinished()
|
||||||
|
{
|
||||||
|
saveMetatileLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::saveMetatileLabel()
|
||||||
{
|
{
|
||||||
if (this->metatile) {
|
if (this->metatile) {
|
||||||
Metatile *prevMetatile = this->metatile->copy();
|
Metatile *prevMetatile = this->metatile->copy();
|
||||||
|
@ -339,6 +344,12 @@ void TilesetEditor::on_comboBox_layerType_activated(int layerType)
|
||||||
|
|
||||||
void TilesetEditor::on_actionSave_Tileset_triggered()
|
void TilesetEditor::on_actionSave_Tileset_triggered()
|
||||||
{
|
{
|
||||||
|
if (this->metatile) {
|
||||||
|
if (this->metatile->label != this->ui->lineEdit_metatileLabel->text()) {
|
||||||
|
saveMetatileLabel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->project->saveTilesets(this->primaryTileset, this->secondaryTileset);
|
this->project->saveTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
emit this->tilesetsSaved(this->primaryTileset->name, this->secondaryTileset->name);
|
emit this->tilesetsSaved(this->primaryTileset->name, this->secondaryTileset->name);
|
||||||
if (this->paletteEditor) {
|
if (this->paletteEditor) {
|
||||||
|
|
Loading…
Reference in a new issue