diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index e361b1b4..347ccf59 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -59,6 +59,8 @@ MainWindow::MainWindow(Core::Application *app, QWidget *parent) : m_settingsDialog(new SettingsDialog(app, m_zealListModel, this)), m_globalShortcut(new QxtGlobalShortcut(m_settings->showShortcut, this)) { + connect(m_settings, &Core::Settings::updated, this, &MainWindow::applySettings); + m_tabBar = new QTabBar(this); setWindowIcon(QIcon::fromTheme(QStringLiteral("zeal"), QIcon(QStringLiteral(":/zeal.ico")))); @@ -120,16 +122,7 @@ MainWindow::MainWindow(Core::Application *app, QWidget *parent) : connect(ui->actionOptions, &QAction::triggered, [=]() { m_globalShortcut->setEnabled(false); - - if (m_settingsDialog->exec()) { - m_globalShortcut->setShortcut(m_settings->showShortcut); - - if (m_settings->showSystrayIcon) - createTrayIcon(); - else - removeTrayIcon(); - } - + m_settingsDialog->exec(); m_globalShortcut->setEnabled(true); }); @@ -764,3 +757,13 @@ void MainWindow::keyPressEvent(QKeyEvent *keyEvent) break; } } + +void MainWindow::applySettings() +{ + m_globalShortcut->setShortcut(m_settings->showShortcut); + + if (m_settings->showSystrayIcon) + createTrayIcon(); + else + removeTrayIcon(); +} diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index d6ef2d01..c7acdd8e 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -82,6 +82,7 @@ protected: void keyPressEvent(QKeyEvent *keyEvent) override; private slots: + void applySettings(); void back(); void forward(); void onSearchComplete();