Fix paste for Wild Pokemon not updating data in memory

This commit is contained in:
GriffinR 2025-07-01 16:10:10 -04:00
parent 6ab6a13f2f
commit 17e4cbfa30
3 changed files with 11 additions and 8 deletions

View File

@ -12,6 +12,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
### Fixed
- Fix metatile images exporting at 2x scale.
- Fix pasting Wild Pokémon data then changing maps resetting the pasted data.
- Fix click-drag map selections behaving unexpectedly when the cursor is outside the map grid.
- Fix events being dragged in negative coordinates lagging behind the cursor.
- Fix the shortcut for duplicating events working while on the Connections tab.

View File

@ -33,6 +33,9 @@ public slots:
void setTabActive(int index, bool active = true);
void deactivateTab(int tabIndex);
signals:
void edited();
private:
void actionCopyTab(int index);
void actionAddDeleteTab(int index);

View File

@ -11,6 +11,9 @@ static WildMonInfo encounterClipboard;
MonTabWidget::MonTabWidget(Editor *editor, QWidget *parent) : QTabWidget(parent) {
this->editor = editor;
connect(this, &MonTabWidget::edited, this->editor, &Editor::saveEncounterTabData);
connect(this, &MonTabWidget::edited, this->editor, &Editor::wildMonTableEdited);
populate();
this->tabBar()->installEventFilter(new WheelFilter(this));
}
@ -64,7 +67,7 @@ void MonTabWidget::paste(int index) {
WildMonInfo newInfo = getDefaultMonInfo(this->editor->project->wildMonFields.at(index));
combineEncounters(newInfo, encounterClipboard);
populateTab(index, newInfo);
emit editor->wildMonTableEdited();
emit edited();
}
void MonTabWidget::actionCopyTab(int index) {
@ -88,15 +91,12 @@ void MonTabWidget::actionAddDeleteTab(int index) {
if (activeTabs[index]) {
// delete tab
deactivateTab(index);
editor->saveEncounterTabData();
}
else {
} else {
// add tab
populateTab(index, getDefaultMonInfo(editor->project->wildMonFields.at(index)));
editor->saveEncounterTabData();
setCurrentIndex(index);
}
emit editor->wildMonTableEdited();
emit edited();
}
void MonTabWidget::clearTableAt(int tabIndex) {
@ -123,8 +123,7 @@ void MonTabWidget::populateTab(int tabIndex, WildMonInfo monInfo) {
QTableView *speciesTable = tableAt(tabIndex);
EncounterTableModel *model = new EncounterTableModel(monInfo, editor->project->wildMonFields[tabIndex], this);
connect(model, &EncounterTableModel::edited, editor, &Editor::saveEncounterTabData);
connect(model, &EncounterTableModel::edited, editor, &Editor::wildMonTableEdited);
connect(model, &EncounterTableModel::edited, this, &MonTabWidget::edited);
speciesTable->setModel(model);
speciesTable->setItemDelegateForColumn(EncounterTableModel::ColumnType::Species, new SpeciesComboDelegate(editor->project, this));