Simplfy warp warning button connection

This commit is contained in:
GriffinR 2025-05-11 15:09:02 -04:00
parent 6f42f86289
commit aaf364248e

View File

@ -3102,15 +3102,13 @@ void MainWindow::onWarpBehaviorWarningClicked() {
"<br></html></body></p>"
);
QPointer msgBox = new InfoMessage(QStringLiteral("Warp Events only function as exits on certain metatiles"), this);
auto msgBox = new InfoMessage(QStringLiteral("Warp Events only function as exits on certain metatiles"), this);
auto settingsButton = msgBox->addButton("Open Settings...", QMessageBox::ActionRole);
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setTextFormat(Qt::RichText);
msgBox->setInformativeText(informative);
connect(msgBox, &InfoMessage::finished, [this, msgBox, settingsButton] {
if (msgBox && msgBox->clickedButton() && msgBox->clickedButton() == settingsButton) {
openProjectSettingsEditor(ProjectSettingsEditor::eventsTab);
}
connect(settingsButton, &QAbstractButton::clicked, [this] {
openProjectSettingsEditor(ProjectSettingsEditor::eventsTab);
});
msgBox->open();
}