@@ -11,6 +11,9 @@ static WildMonInfo encounterClipboard;
1111
1212MonTabWidget::MonTabWidget (Editor *editor, QWidget *parent) : QTabWidget(parent) {
1313 this ->editor = editor;
14+ connect (this , &MonTabWidget::edited, this ->editor , &Editor::saveEncounterTabData);
15+ connect (this , &MonTabWidget::edited, this ->editor , &Editor::wildMonTableEdited);
16+
1417 populate ();
1518 this ->tabBar ()->installEventFilter (new WheelFilter (this ));
1619}
@@ -64,7 +67,7 @@ void MonTabWidget::paste(int index) {
6467 WildMonInfo newInfo = getDefaultMonInfo (this ->editor ->project ->wildMonFields .at (index));
6568 combineEncounters (newInfo, encounterClipboard);
6669 populateTab (index, newInfo);
67- emit editor-> wildMonTableEdited ();
70+ emit edited ();
6871}
6972
7073void MonTabWidget::actionCopyTab (int index) {
@@ -88,15 +91,12 @@ void MonTabWidget::actionAddDeleteTab(int index) {
8891 if (activeTabs[index]) {
8992 // delete tab
9093 deactivateTab (index);
91- editor->saveEncounterTabData ();
92- }
93- else {
94+ } else {
9495 // add tab
9596 populateTab (index, getDefaultMonInfo (editor->project ->wildMonFields .at (index)));
96- editor->saveEncounterTabData ();
9797 setCurrentIndex (index);
9898 }
99- emit editor-> wildMonTableEdited ();
99+ emit edited ();
100100}
101101
102102void MonTabWidget::clearTableAt (int tabIndex) {
@@ -123,8 +123,7 @@ void MonTabWidget::populateTab(int tabIndex, WildMonInfo monInfo) {
123123 QTableView *speciesTable = tableAt (tabIndex);
124124
125125 EncounterTableModel *model = new EncounterTableModel (monInfo, editor->project ->wildMonFields [tabIndex], this );
126- connect (model, &EncounterTableModel::edited, editor, &Editor::saveEncounterTabData);
127- connect (model, &EncounterTableModel::edited, editor, &Editor::wildMonTableEdited);
126+ connect (model, &EncounterTableModel::edited, this , &MonTabWidget::edited);
128127 speciesTable->setModel (model);
129128
130129 speciesTable->setItemDelegateForColumn (EncounterTableModel::ColumnType::Species, new SpeciesComboDelegate (editor->project , this ));
0 commit comments