change the minium font size globally

This commit is contained in:
spacewander 2014-11-07 23:07:21 +08:00
parent e4d3aa22e5
commit 4290f73fca
5 changed files with 17 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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());

View File

@ -6,7 +6,6 @@
#include <QWebPage>
#include "searchablewebview.h"
SearchableWebView::SearchableWebView(QWidget *parent) :
QWidget(parent), lineEdit(this), webView(this)
{

View File

@ -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)

View File

@ -62,6 +62,7 @@ private:
signals:
void refreshRequested();
void minFontSizeChanged(int minFont);
void webPageStyleUpdated();
private slots:
void downloadDocsetList();