fix event tabs not updating with group size changes

This commit is contained in:
garak 2022-09-06 17:11:36 -04:00
parent 9e54537ba2
commit 679f2419b7
4 changed files with 15 additions and 9 deletions

View file

@ -208,7 +208,6 @@ private slots:
signals:
void objectsChanged();
void selectedObjectsChanged();
void loadMapRequested(QString, QString);
void wildMonDataChanged();
void warpEventDoubleClicked(QString, int, Event::Group);

View file

@ -219,6 +219,7 @@ private slots:
void on_toolButton_deleteObject_clicked();
void addNewEvent(Event::Type type);
void displayEventTabs();
void updateSelectedObjects();
void updateObjects();

View file

@ -2009,7 +2009,7 @@ void Editor::updateSelectedEvents() {
redrawObject(item);
}
emit selectedObjectsChanged();
emit objectsChanged();
}
void Editor::selectMapEvent(DraggablePixmapItem *object) {

View file

@ -252,7 +252,6 @@ void MainWindow::initExtraSignals() {
void MainWindow::initEditor() {
this->editor = new Editor(ui);
connect(this->editor, &Editor::objectsChanged, this, &MainWindow::updateObjects);
connect(this->editor, &Editor::selectedObjectsChanged, this, &MainWindow::updateSelectedObjects);
connect(this->editor, &Editor::loadMapRequested, this, &MainWindow::onLoadMapRequested);
connect(this->editor, &Editor::warpEventDoubleClicked, this, &MainWindow::openWarpMap);
connect(this->editor, &Editor::currentMetatilesSelectionChanged, this, &MainWindow::currentMetatilesSelectionChanged);
@ -1910,12 +1909,9 @@ void MainWindow::addNewEvent(Event::Type type) {
}
}
void MainWindow::updateObjects() {
selectedObject = nullptr;
selectedWarp = nullptr;
selectedTrigger = nullptr;
selectedBG = nullptr;
selectedHealspot = nullptr;
void MainWindow::displayEventTabs() {
const QSignalBlocker blocker(ui->tabWidget_EventType);
ui->tabWidget_EventType->clear();
if (editor->map->events.value(Event::Group::Object).length())
@ -1932,6 +1928,16 @@ void MainWindow::updateObjects() {
if (editor->map->events.value(Event::Group::Heal).length())
ui->tabWidget_EventType->addTab(eventTabHealspotWidget, "Healspots");
}
void MainWindow::updateObjects() {
selectedObject = nullptr;
selectedWarp = nullptr;
selectedTrigger = nullptr;
selectedBG = nullptr;
selectedHealspot = nullptr;
displayEventTabs();
updateSelectedObjects();
}