diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2019-08-19 13:18:44 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2019-08-21 11:18:01 +0200 |
commit | 771fdc5b13f1b13c82eeaf513696b2e564326b80 (patch) | |
tree | 7089f7487fdea386c4f4f68b905c0035e7ab00b9 | |
parent | fd833044a5b986e8dafa124ab7f2c885d60f329d (diff) | |
download | qttools-771fdc5b13f1b13c82eeaf513696b2e564326b80.tar.gz |
Fix applying font and option settings
Move the code which applies changes to applyChanges() method.
Fixes: QTBUG-77399
Change-Id: Ic4436ce65e246c518a6fcdfe119df772a0585468
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/assistant/assistant/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/assistant/assistant/preferencesdialog.cpp | 55 | ||||
-rw-r--r-- | src/assistant/assistant/preferencesdialog.h | 4 |
3 files changed, 26 insertions, 35 deletions
diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp index 2b9c87bbf..fc5fe5b3f 100644 --- a/src/assistant/assistant/mainwindow.cpp +++ b/src/assistant/assistant/mainwindow.cpp @@ -842,7 +842,7 @@ void MainWindow::showPreferences() m_centralWidget, &CentralWidget::updateBrowserFont); connect(&dia, &PreferencesDialog::updateUserInterface, m_centralWidget, &CentralWidget::updateUserInterface); - dia.showDialog(); + dia.exec(); } void MainWindow::syncContents() diff --git a/src/assistant/assistant/preferencesdialog.cpp b/src/assistant/assistant/preferencesdialog.cpp index 7955e08df..67f91326c 100644 --- a/src/assistant/assistant/preferencesdialog.cpp +++ b/src/assistant/assistant/preferencesdialog.cpp @@ -142,31 +142,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) setFont(helpEngine.appFont()); } -PreferencesDialog::~PreferencesDialog() -{ - if (m_appFontChanged) { - helpEngine.setAppFont(m_appFontPanel->selectedFont()); - helpEngine.setUseAppFont(m_appFontPanel->isChecked()); - helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem()); - emit updateApplicationFont(); - } - - if (m_browserFontChanged) { - helpEngine.setBrowserFont(m_browserFontPanel->selectedFont()); - helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked()); - helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem()); - emit updateBrowserFont(); - } - - QString homePage = m_ui.homePageLineEdit->text(); - if (homePage.isEmpty()) - homePage = QLatin1String("help"); - helpEngine.setHomePage(homePage); - - int option = m_ui.helpStartComboBox->currentIndex(); - helpEngine.setStartOption(option); -} - FilterSetup PreferencesDialog::readOriginalSetup() const { FilterSetup filterSetup; @@ -195,12 +170,6 @@ FilterSetup PreferencesDialog::readOriginalSetup() const return filterSetup; } -void PreferencesDialog::showDialog() -{ - if (exec() != Accepted) - m_appFontChanged = m_browserFontChanged = false; -} - void PreferencesDialog::updateFilterPage() { if (m_hideFiltersTab) @@ -563,6 +532,30 @@ void PreferencesDialog::applyChanges() helpEngine.setShowTabs(m_ui.showTabs->isChecked()); if (m_showTabs != m_ui.showTabs->isChecked()) emit updateUserInterface(); + + if (m_appFontChanged) { + helpEngine.setAppFont(m_appFontPanel->selectedFont()); + helpEngine.setUseAppFont(m_appFontPanel->isChecked()); + helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem()); + emit updateApplicationFont(); + m_appFontChanged = false; + } + + if (m_browserFontChanged) { + helpEngine.setBrowserFont(m_browserFontPanel->selectedFont()); + helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked()); + helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem()); + emit updateBrowserFont(); + m_browserFontChanged = false; + } + + QString homePage = m_ui.homePageLineEdit->text(); + if (homePage.isEmpty()) + homePage = QLatin1String("help"); + helpEngine.setHomePage(homePage); + + const int option = m_ui.helpStartComboBox->currentIndex(); + helpEngine.setStartOption(option); } void PreferencesDialog::updateFontSettingsPage() diff --git a/src/assistant/assistant/preferencesdialog.h b/src/assistant/assistant/preferencesdialog.h index 89c30c568..1ff39e326 100644 --- a/src/assistant/assistant/preferencesdialog.h +++ b/src/assistant/assistant/preferencesdialog.h @@ -29,6 +29,7 @@ #ifndef PREFERENCESDIALOG_H #define PREFERENCESDIALOG_H +#include <QtCore/QVersionNumber> #include <QtWidgets/QDialog> #include <QtHelp/QHelpFilterData> #include "ui_preferencesdialog.h" @@ -60,9 +61,6 @@ class PreferencesDialog : public QDialog public: PreferencesDialog(QWidget *parent = nullptr); - ~PreferencesDialog() override; - - void showDialog(); private slots: void filterSelected(QListWidgetItem *item); |