mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-08 02:54:03 -05:00
Restore layout selector if left in invalid state
This commit is contained in:
parent
1375572be1
commit
4b1332609e
|
|
@ -204,6 +204,7 @@ private slots:
|
|||
void on_actionNew_Tileset_triggered();
|
||||
void on_action_Save_triggered();
|
||||
void on_action_Exit_triggered();
|
||||
void onLayoutSelectorEditingFinished();
|
||||
void on_comboBox_LayoutSelector_currentTextChanged(const QString &text);
|
||||
void on_actionShortcuts_triggered();
|
||||
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ void MainWindow::initExtraSignals() {
|
|||
connect(ui->action_NewMap, &QAction::triggered, this, &MainWindow::openNewMapDialog);
|
||||
connect(ui->action_NewLayout, &QAction::triggered, this, &MainWindow::openNewLayoutDialog);
|
||||
connect(ui->actionDuplicate_Current_Map_Layout, &QAction::triggered, this, &MainWindow::openDuplicateMapOrLayoutDialog);
|
||||
connect(ui->comboBox_LayoutSelector->lineEdit(), &QLineEdit::editingFinished, this, &MainWindow::onLayoutSelectorEditingFinished);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCheck_for_Updates_triggered() {
|
||||
|
|
@ -1090,6 +1091,18 @@ void MainWindow::on_comboBox_LayoutSelector_currentTextChanged(const QString &te
|
|||
markMapEdited();
|
||||
}
|
||||
|
||||
void MainWindow::onLayoutSelectorEditingFinished() {
|
||||
if (!this->editor || !this->editor->project || !this->editor->layout)
|
||||
return;
|
||||
|
||||
// If the user left the layout selector in an invalid state, restore it so that it displays the current layout.
|
||||
const QString text = ui->comboBox_LayoutSelector->currentText();
|
||||
if (!this->editor->project->mapLayouts.contains(text)) {
|
||||
const QSignalBlocker b(ui->comboBox_LayoutSelector);
|
||||
ui->comboBox_LayoutSelector->setCurrentText(this->editor->layout->id);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the UI using information we've read from the user's project files.
|
||||
bool MainWindow::setProjectUI() {
|
||||
Project *project = editor->project;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user