summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-01-26 01:50:50 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-01-26 01:50:50 +0100
commit38aee2a224a198e2f1144e5c71039fd17f317c78 (patch)
tree5327223dffdb604e0aa9b2e49257b19a5190db02
parent234f77a65dfd6562a6a845636be4f1bd02040cf1 (diff)
api, gui: close options dlg on Esc inside inner dlg
-rw-r--r--api/plugin-api.cpp6
-rw-r--r--gui/options-dialog.cpp3
2 files changed, 5 insertions, 4 deletions
diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp
index 5c83e42f..ef9e47a1 100644
--- a/api/plugin-api.cpp
+++ b/api/plugin-api.cpp
@@ -1,4 +1,5 @@
#include "plugin-api.hpp"
+#include <QDebug>
namespace plugin_api::detail {
@@ -7,18 +8,15 @@ void BaseDialog::closeEvent(QCloseEvent*)
{
if (isVisible())
{
- hide();
emit closing();
+ close();
}
}
void BaseDialog::done(int)
{
if (isVisible())
- {
- hide();
close();
- }
}
bool BaseDialog::embeddable() noexcept { return false; }
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp
index d1769ea8..ac4117bc 100644
--- a/gui/options-dialog.cpp
+++ b/gui/options-dialog.cpp
@@ -179,9 +179,12 @@ options_dialog::options_dialog(std::unique_ptr<ITrackerDialog>& tracker_dialog_,
auto add_module_tab = [this] (auto& place, auto&& dlg, const QString& label) {
if (dlg && dlg->embeddable())
{
+ using BaseDialog = plugin_api::detail::BaseDialog;
+
dlg->set_buttons_visible(false);
place = dlg.release();
ui.tabWidget->addTab(place, label);
+ QObject::connect(place, &BaseDialog::closing, this, &QDialog::close);
}
};