diff --git a/src/qt_gui/kbm_config_dialog.cpp b/src/qt_gui/kbm_config_dialog.cpp index c808629d2..6931c336c 100644 --- a/src/qt_gui/kbm_config_dialog.cpp +++ b/src/qt_gui/kbm_config_dialog.cpp @@ -144,7 +144,7 @@ bool isHelpOpen = false; HelpDialog* helpDialog; void EditorDialog::onHelpClicked() { if (!isHelpOpen) { - helpDialog = new HelpDialog(this); + helpDialog = new HelpDialog(&isHelpOpen, this); helpDialog->setWindowTitle("Help"); helpDialog->setAttribute(Qt::WA_DeleteOnClose); // Clean up on close // Get the position and size of the Config window diff --git a/src/qt_gui/kbm_help_dialog.cpp b/src/qt_gui/kbm_help_dialog.cpp index feb24ce5d..6b27b5e9c 100644 --- a/src/qt_gui/kbm_help_dialog.cpp +++ b/src/qt_gui/kbm_help_dialog.cpp @@ -58,7 +58,13 @@ ExpandableSection::ExpandableSection(const QString& title, const QString& conten layout->setContentsMargins(0, 0, 0, 0); } -HelpDialog::HelpDialog(QWidget* parent) : QDialog(parent) { +void HelpDialog::closeEvent(QCloseEvent* event) { + *help_open_ptr = false; + close(); +} + +HelpDialog::HelpDialog(bool* open_flag, QWidget* parent) : QDialog(parent) { + help_open_ptr = open_flag; // Main layout for the help dialog QVBoxLayout* mainLayout = new QVBoxLayout(this); diff --git a/src/qt_gui/kbm_help_dialog.h b/src/qt_gui/kbm_help_dialog.h index d9270e9bf..4348f9a33 100644 --- a/src/qt_gui/kbm_help_dialog.h +++ b/src/qt_gui/kbm_help_dialog.h @@ -33,9 +33,14 @@ private: class HelpDialog : public QDialog { Q_OBJECT public: - explicit HelpDialog(QWidget* parent = nullptr); + explicit HelpDialog(bool* open_flag = nullptr, QWidget* parent = nullptr); + +protected: + void closeEvent(QCloseEvent* event) override; private: + bool* help_open_ptr; + QString quickstart() { return R"(The keyboard remapping backend, GUI and documentation have been written by kalaposfos