diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 3b3adbfb7..c66594012 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -94,6 +94,7 @@ static const QHash configStrings = { {Config::GUI_MovableToolbar, {QS("GUI/MovableToolbar"), Roaming, false}}, {Config::GUI_HideGroupsPanel, {QS("GUI/HideGroupsPanel"), Roaming, false}}, {Config::GUI_HidePreviewPanel, {QS("GUI/HidePreviewPanel"), Roaming, false}}, + {Config::GUI_AlwaysOnTop, {QS("GUI/GUI_AlwaysOnTop"), Roaming, false}}, {Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}}, {Config::GUI_ShowTrayIcon, {QS("GUI/ShowTrayIcon"), Roaming, false}}, {Config::GUI_TrayIconAppearance, {QS("GUI/TrayIconAppearance"), Roaming, {}}}, diff --git a/src/core/Config.h b/src/core/Config.h index fc8af88e0..6d69ee2a3 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -76,6 +76,7 @@ public: GUI_MovableToolbar, GUI_HideGroupsPanel, GUI_HidePreviewPanel, + GUI_AlwaysOnTop, GUI_ToolButtonStyle, GUI_ShowTrayIcon, GUI_TrayIconAppearance, diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index dcc4d34cf..8a6ea610a 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1831,6 +1831,7 @@ void MainWindow::initViewMenu() }); connect(m_ui->actionAlwaysOnTop, &QAction::toggled, this, [this](bool checked) { + config()->set(Config::GUI_AlwaysOnTop, checked); if (checked) { setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); } else { @@ -1838,6 +1839,8 @@ void MainWindow::initViewMenu() } show(); }); + // Set checked after connecting to act on a toggle in state (default state is unchecked) + m_ui->actionAlwaysOnTop->setChecked(config()->get(Config::GUI_AlwaysOnTop).toBool()); m_ui->actionHideUsernames->setChecked(config()->get(Config::GUI_HideUsernames).toBool()); connect(m_ui->actionHideUsernames, &QAction::toggled, this, [](bool checked) {