diff --git a/zeal/mainwindow.cpp b/zeal/mainwindow.cpp index 7cafb6e..c1c5b14 100644 --- a/zeal/mainwindow.cpp +++ b/zeal/mainwindow.cpp @@ -126,7 +126,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->splitter, &QSplitter::splitterMoved, [=](int, int) { settings.setValue("splitter", ui->splitter->saveState()); }); - ui->webView->settings()->setFontSize(QWebSettings::MinimumFontSize, settings.value("minFontSize").toInt()); + + applyWebPageStyle(); ZealNetworkAccessManager * zealNaManager = new ZealNetworkAccessManager(); zealNaManager->setProxy(settingsDialog.httpProxy()); ui->webView->page()->setNetworkAccessManager(zealNaManager); @@ -146,6 +147,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(&settingsDialog, SIGNAL(refreshRequested()), this, SLOT(refreshRequest())); connect(&settingsDialog, SIGNAL(minFontSizeChanged(int)), this, SLOT(changeMinFontSize(int))); + connect(&settingsDialog, SIGNAL(webPageStyleUpdated()), this, SLOT(applyWebPageStyle())); connect(ui->action_Options, &QAction::triggered, [=]() { settingsDialog.setHotKey(hotKey); @@ -850,5 +852,13 @@ void MainWindow::refreshRequest(){ } void MainWindow::changeMinFontSize(int minFont){ - ui->webView->settings()->setFontSize(QWebSettings::MinimumFontSize, minFont); + QWebSettings::globalSettings()->setFontSize(QWebSettings::MinimumFontSize, minFont); +} + +void MainWindow::applyWebPageStyle() +{ + if (settings.contains("minFontSize")) { + int minFont = settings.value("minFontSize").toInt(); + QWebSettings::globalSettings()->setFontSize(QWebSettings::MinimumFontSize, minFont); + } } diff --git a/zeal/mainwindow.h b/zeal/mainwindow.h index 679dc09..fd74928 100644 --- a/zeal/mainwindow.h +++ b/zeal/mainwindow.h @@ -93,6 +93,7 @@ private: ZealNativeEventFilter nativeFilter; ZealSettingsDialog settingsDialog; QSystemTrayIcon *trayIcon; + #ifdef USE_LIBAPPINDICATOR AppIndicator *indicator; //for Unity #endif @@ -111,6 +112,7 @@ private slots: void saveTabState(); void goToTab(int index); void closeTab(int index); + void applyWebPageStyle(); protected: void closeEvent(QCloseEvent *event) { settings.setValue("geometry", saveGeometry()); diff --git a/zeal/widgets/searchablewebview.cpp b/zeal/widgets/searchablewebview.cpp index 6b29939..053edc9 100644 --- a/zeal/widgets/searchablewebview.cpp +++ b/zeal/widgets/searchablewebview.cpp @@ -6,7 +6,6 @@ #include #include "searchablewebview.h" - SearchableWebView::SearchableWebView(QWidget *parent) : QWidget(parent), lineEdit(this), webView(this) { diff --git a/zeal/zealsettingsdialog.cpp b/zeal/zealsettingsdialog.cpp index 8cce8b5..518c7e9 100644 --- a/zeal/zealsettingsdialog.cpp +++ b/zeal/zealsettingsdialog.cpp @@ -771,6 +771,8 @@ void ZealSettingsDialog::saveSettings(){ settings.setValue("httpProxyUser", ui->m_httpProxyUser->text()); settings.setValue("httpProxyPass", ui->m_httpProxyPass->text()); settings.setValue("prefixes", prefixes); + + webPageStyleUpdated(); } void ZealSettingsDialog::on_tabWidget_currentChanged(int current) diff --git a/zeal/zealsettingsdialog.h b/zeal/zealsettingsdialog.h index 2bc8023..7f69551 100644 --- a/zeal/zealsettingsdialog.h +++ b/zeal/zealsettingsdialog.h @@ -62,6 +62,7 @@ private: signals: void refreshRequested(); void minFontSizeChanged(int minFont); + void webPageStyleUpdated(); private slots: void downloadDocsetList();