diff options
author | kh1 <qt-info@nokia.com> | 2010-02-12 15:33:04 (GMT) |
---|---|---|
committer | kh1 <qt-info@nokia.com> | 2010-02-12 15:53:40 (GMT) |
commit | 0ff252da26185709cbeeabddd07e6d9ab83de4a4 (patch) | |
tree | 1654232b4fd117a50992350315ee3fa433ced6ad /tools/assistant | |
parent | 03faf2750e02f78c5f3fd1589da00a6bcfa20e53 (diff) | |
download | Qt-0ff252da26185709cbeeabddd07e6d9ab83de4a4.zip Qt-0ff252da26185709cbeeabddd07e6d9ab83de4a4.tar.gz Qt-0ff252da26185709cbeeabddd07e6d9ab83de4a4.tar.bz2 |
Refactor font and zoom handling, reduces clutter in central widget.
Reviewed-by: ck
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/tools/assistant/bookmarkdialog.cpp | 8 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/centralwidget.cpp | 98 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/centralwidget.h | 5 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.h | 11 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qtb.cpp | 111 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qtb.h | 21 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qwv.cpp | 71 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qwv.h | 22 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/mainwindow.cpp | 6 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/preferencesdialog.cpp | 26 |
10 files changed, 212 insertions, 167 deletions
diff --git a/tools/assistant/tools/assistant/bookmarkdialog.cpp b/tools/assistant/tools/assistant/bookmarkdialog.cpp index f081c15..c053b62 100644 --- a/tools/assistant/tools/assistant/bookmarkdialog.cpp +++ b/tools/assistant/tools/assistant/bookmarkdialog.cpp @@ -38,12 +38,12 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "tracer.h" - #include "bookmarkdialog.h" #include "bookmarkfiltermodel.h" #include "bookmarkitem.h" #include "bookmarkmodel.h" +#include "helpenginewrapper.h" +#include "tracer.h" #include <QtGui/QKeyEvent> #include <QtGui/QMenu> @@ -94,6 +94,10 @@ BookmarkDialog::BookmarkDialog(BookmarkModel *sourceModel, const QString &title, ui.bookmarkFolders->setCurrentIndex(0); ui.treeView->setCurrentIndex(ui.treeView->indexAt(QPoint(2, 2))); + + const HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); + if (helpEngine.usesAppFont()) + setFont(helpEngine.appFont()); } BookmarkDialog::~BookmarkDialog() diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index c780df6..dd91326 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -72,6 +72,7 @@ namespace { HelpViewer* helpViewerFromTabPosition(const QTabWidget *widget, const QPoint &point) { + TRACE_OBJ QTabBar *tabBar = qFindChild<QTabBar*>(widget); for (int i = 0; i < tabBar->count(); ++i) { if (tabBar->tabRect(i).contains(point)) @@ -174,7 +175,7 @@ CentralWidget::~CentralWidget() HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i)); if (viewer && viewer->source().isValid()) { currentPages << viewer->source().toString(); - zoomFactors << QString::number(viewer->zoom()); + zoomFactors << QString::number(viewer->scale()); } } @@ -208,7 +209,7 @@ void CentralWidget::zoomIn() TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) - viewer->zoomIn(); + viewer->scaleUp(); if (tabWidget->currentWidget() == m_searchWidget) m_searchWidget->zoomIn(); @@ -219,7 +220,7 @@ void CentralWidget::zoomOut() TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) - viewer->zoomOut(); + viewer->scaleDown(); if (tabWidget->currentWidget() == m_searchWidget) m_searchWidget->zoomOut(); @@ -237,9 +238,8 @@ void CentralWidget::nextPage() void CentralWidget::resetZoom() { TRACE_OBJ - HelpViewer *viewer = currentHelpViewer(); - if (viewer) - viewer->resetZoom(); + if (HelpViewer *viewer = currentHelpViewer()) + viewer->resetScale(); if (tabWidget->currentWidget() == m_searchWidget) m_searchWidget->resetZoom(); @@ -522,25 +522,12 @@ void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom) return; #endif - viewer = new HelpViewer(this); + viewer = new HelpViewer(this, zoom); viewer->installEventFilter(this); viewer->setSource(url); viewer->setFocus(Qt::OtherFocusReason); tabWidget->setCurrentIndex(tabWidget->addTab(viewer, quoteTabTitle(viewer->documentTitle()))); - - QFont font; - getBrowserFontFor(viewer, &font); - -#if defined(QT_NO_WEBKIT) - font.setPointSize((int)(font.pointSize() + zoom)); - setBrowserFontFor(viewer, font); - viewer->setZoom((int)zoom); -#else - setBrowserFontFor(viewer, font); - viewer->setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom); -#endif - connectSignals(); } @@ -579,7 +566,13 @@ void CentralWidget::connectSignals() } } -HelpViewer *CentralWidget::currentHelpViewer() const +HelpViewer* CentralWidget::viewerAt(int index) const +{ + TRACE_OBJ + return qobject_cast<HelpViewer*>(tabWidget->widget(index)); +} + +HelpViewer* CentralWidget::currentHelpViewer() const { TRACE_OBJ return qobject_cast<HelpViewer*>(tabWidget->currentWidget()); @@ -755,6 +748,7 @@ void CentralWidget::keyPressEvent(QKeyEvent *e) void CentralWidget::findNext() { + TRACE_OBJ find(findWidget->text(), true); } @@ -876,21 +870,24 @@ bool CentralWidget::findInTextBrowser(const QString &ttf, bool forward) void CentralWidget::updateBrowserFont() { TRACE_OBJ - QFont font; - bool searchAttached = searchWidgetAttached(); + const bool searchAttached = searchWidgetAttached(); if (searchAttached) { - getBrowserFontFor(m_searchWidget, &font); - setBrowserFontFor(m_searchWidget, font); + HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); + m_searchWidget->setFont(helpEngine.usesBrowserFont() + ? helpEngine.browserFont() : qApp->font()); } - int i = searchAttached ? 1 : 0; - getBrowserFontFor(tabWidget->widget(i), &font); - for ( ; i < tabWidget->count(); ++i) - setBrowserFontFor(tabWidget->widget(i), font); + const int count = tabWidget->count(); + if (HelpViewer* viewer = viewerAt(count - 1)) { + const QFont &font = viewer->viewerFont(); + for (int i = searchAttached ? 1 : 0; i < count; ++i) + viewerAt(i)->setViewerFont(font); + } } bool CentralWidget::searchWidgetAttached() const { + TRACE_OBJ return m_searchWidget && m_searchWidget->isAttached(); } @@ -906,9 +903,9 @@ void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine) connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this, SLOT(setSourceFromSearchInNewTab(QUrl))); - QFont font; - getBrowserFontFor(m_searchWidget, &font); - setBrowserFontFor(m_searchWidget, font); + HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); + m_searchWidget->setFont(!helpEngine.usesBrowserFont() ? qApp->font() + : helpEngine.browserFont()); } void CentralWidget::activateSearchWidget(bool updateLastTabPage) @@ -1103,41 +1100,4 @@ QMap<int, QString> CentralWidget::currentSourceFileList() const return sourceList; } -void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font) -{ - TRACE_OBJ - HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); - if (!helpEngine.usesBrowserFont()) { - *font = qApp->font(); // case for QTextBrowser and SearchWidget -#if !defined(QT_NO_WEBKIT) - QWebView *view = qobject_cast<QWebView*> (viewer); - if (view) { - QWebSettings *settings = QWebSettings::globalSettings(); - *font = QFont(settings->fontFamily(QWebSettings::StandardFont), - settings->fontSize(QWebSettings::DefaultFontSize)); - } -#endif - } else { - *font = helpEngine.browserFont(); - } -} - -void CentralWidget::setBrowserFontFor(QWidget *widget, const QFont &font) -{ - TRACE_OBJ -#if !defined(QT_NO_WEBKIT) - QWebView *view = qobject_cast<QWebView*> (widget); - if (view) { - QWebSettings *settings = view->settings(); - settings->setFontFamily(QWebSettings::StandardFont, font.family()); - settings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize()); - } else if (widget && widget->font() != font) { - widget->setFont(font); - } -#else - if (widget && widget->font() != font) - widget->setFont(font); -#endif -} - QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h index 6c3e93c..f286ff7 100644 --- a/tools/assistant/tools/assistant/centralwidget.h +++ b/tools/assistant/tools/assistant/centralwidget.h @@ -70,6 +70,8 @@ public: bool isBackwardAvailable() const; QList<QAction*> globalActions() const; void setGlobalActions(const QList<QAction*> &actions); + + HelpViewer *viewerAt(int index) const; HelpViewer *currentHelpViewer() const; bool searchWidgetAttached() const; @@ -143,9 +145,6 @@ private: QString quoteTabTitle(const QString &title) const; void setLastShownPages(); - void getBrowserFontFor(QWidget* viewer, QFont *font); - void setBrowserFontFor(QWidget *widget, const QFont &font); - private: int lastTabPage; QList<QAction*> globalActionList; diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index 276cd1f..fe860fd 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -43,6 +43,8 @@ #include <QtCore/QString> +#include <QtGui/QFont> + QT_BEGIN_NAMESPACE class QUrl; @@ -53,6 +55,15 @@ public: AbstractHelpViewer(); ~AbstractHelpViewer(); + virtual QFont viewerFont() const = 0; + virtual void setViewerFont(const QFont &font) = 0; + + virtual void scaleUp() = 0; + virtual void scaleDown() = 0; + + virtual void resetScale() = 0; + virtual qreal scale() const = 0; + static QString PageNotFoundMessage; static bool isLocalUrl(const QUrl &url); static bool canOpenPage(const QString &url); diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp index dc35878..3aafe67 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp @@ -59,16 +59,78 @@ QT_BEGIN_NAMESPACE -HelpViewer::HelpViewer(CentralWidget *parent) +HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom) : QTextBrowser(parent) - , zoomCount(0) + , zoomCount(zoom) , controlPressed(false) , lastAnchor(QString()) , parentWidget(parent) , helpEngine(HelpEngineWrapper::instance()) + , forceFont(false) { TRACE_OBJ - document()->setDocumentMargin(8); + installEventFilter(this); + document()->setDocumentMargin(8); + + QFont font = viewerFont(); + font.setPointSize(int(font.pointSize() + zoom)); + setViewerFont(font); +} + +HelpViewer::~HelpViewer() +{ + TRACE_OBJ +} + +QFont HelpViewer::viewerFont() const +{ + TRACE_OBJ + if (HelpEngineWrapper::instance().usesBrowserFont()) + return helpEngine.browserFont(); + return qApp->font(); +} + +void HelpViewer::setViewerFont(const QFont &newFont) +{ + TRACE_OBJ + if (font() != newFont) { + forceFont = true; + setFont(newFont); + forceFont = false; + } +} + +void HelpViewer::scaleUp() +{ + TRACE_OBJ + if (zoomCount < 10) { + ++zoomCount; + forceFont = true; + zoomIn(); + forceFont = false; + } +} + +void HelpViewer::scaleDown() +{ + TRACE_OBJ + if (zoomCount > -5) { + --zoomCount; + forceFont = true; + zoomOut(); + forceFont = false; + } +} + +void HelpViewer::resetScale() +{ + TRACE_OBJ + if (zoomCount != 0) { + forceFont = true; + zoomOut(zoomCount); + forceFont = false; + } + zoomCount = 0; } void HelpViewer::setSource(const QUrl &url) @@ -96,36 +158,6 @@ void HelpViewer::setSource(const QUrl &url) } } -void HelpViewer::resetZoom() -{ - TRACE_OBJ - if (zoomCount == 0) - return; - - QTextBrowser::zoomOut(zoomCount); - zoomCount = 0; -} - -void HelpViewer::zoomIn(int range) -{ - TRACE_OBJ - if (zoomCount == 10) - return; - - QTextBrowser::zoomIn(range); - zoomCount++; -} - -void HelpViewer::zoomOut(int range) -{ - TRACE_OBJ - if (zoomCount == -5) - return; - - QTextBrowser::zoomOut(range); - zoomCount--; -} - bool HelpViewer::launchedWithExternalApp(const QUrl &url) { TRACE_OBJ @@ -278,15 +310,22 @@ void HelpViewer::home() void HelpViewer::wheelEvent(QWheelEvent *e) { TRACE_OBJ - if (e->modifiers() == Qt::CTRL) { + if (e->modifiers() == Qt::ControlModifier) { e->accept(); - (e->delta() > 0) ? zoomIn() : zoomOut(); + e->delta() > 0 ? scaleUp() : scaleDown(); } else { - e->ignore(); QTextBrowser::wheelEvent(e); } } +bool HelpViewer::eventFilter(QObject *obj, QEvent *event) +{ + TRACE_OBJ + if (event->type() == QEvent::FontChange && !forceFont) + return true; + return QTextBrowser::eventFilter(obj, event); +} + QT_END_NAMESPACE #endif // QT_NO_WEBKIT diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.h b/tools/assistant/tools/assistant/helpviewer_qtb.h index 09f5370..e927b34 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.h +++ b/tools/assistant/tools/assistant/helpviewer_qtb.h @@ -63,14 +63,18 @@ class HelpViewer : public QTextBrowser, public AbstractHelpViewer Q_OBJECT public: - HelpViewer(CentralWidget *parent); - void setSource(const QUrl &url); + HelpViewer(CentralWidget *parent, qreal zoom = 0.0); + ~HelpViewer(); + + QFont viewerFont() const; + void setViewerFont(const QFont &font); - void resetZoom(); - void zoomIn(int range = 1); - void zoomOut(int range = 1); - int zoom() const { return zoomCount; } - void setZoom(int zoom) { zoomCount = zoom; } + void scaleUp(); + void scaleDown(); + void resetScale(); + qreal scale() const { return zoomCount; } + + void setSource(const QUrl &url); inline bool hasSelection() const { return textCursor().hasSelection(); } @@ -82,6 +86,7 @@ public Q_SLOTS: protected: void wheelEvent(QWheelEvent *e); + bool eventFilter(QObject *obj, QEvent *event); private: QVariant loadResource(int type, const QUrl &name); @@ -100,6 +105,8 @@ private: QString lastAnchor; CentralWidget* parentWidget; HelpEngineWrapper &helpEngine; + + bool forceFont; }; QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index d2e0019..4857e00 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -252,7 +252,9 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *, return false; } -HelpViewer::HelpViewer(CentralWidget *parent) +// -- HelpViewer + +HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom) : QWebView(parent) , parentWidget(parent) , loadFinished(false) @@ -284,36 +286,63 @@ HelpViewer::HelpViewer(CentralWidget *parent) SIGNAL(highlighted(QString))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); + + setFont(viewerFont()); + setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom); } -void HelpViewer::setSource(const QUrl &url) +HelpViewer::~HelpViewer() { TRACE_OBJ - loadFinished = false; - if (url.toString() == QLatin1String("help")) { - load(QUrl(QLatin1String("qthelp://com.trolltech.com." - "assistantinternal-1.0.0/assistant/assistant.html"))); - } else { - load(url); - } } -void HelpViewer::resetZoom() +QFont HelpViewer::viewerFont() const { TRACE_OBJ - setTextSizeMultiplier(1.0); + if (helpEngine.usesBrowserFont()) + return helpEngine.browserFont(); + + QWebSettings *webSettings = QWebSettings::globalSettings(); + return QFont(webSettings->fontFamily(QWebSettings::StandardFont), + webSettings->fontSize(QWebSettings::DefaultFontSize)); } -void HelpViewer::zoomIn(qreal range) +void HelpViewer::setViewerFont(const QFont &font) { TRACE_OBJ - setTextSizeMultiplier(textSizeMultiplier() + range / 10.0); + QWebSettings *webSettings = settings(); + webSettings->setFontFamily(QWebSettings::StandardFont, font.family()); + webSettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize()); } -void HelpViewer::zoomOut(qreal range) +void HelpViewer::scaleUp() { TRACE_OBJ - setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - range / 10.0)); + setTextSizeMultiplier(textSizeMultiplier() + 0.1); +} + +void HelpViewer::scaleDown() +{ + TRACE_OBJ + setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - 0.1)); +} + +void HelpViewer::resetScale() +{ + TRACE_OBJ + setTextSizeMultiplier(1.0); +} + +void HelpViewer::setSource(const QUrl &url) +{ + TRACE_OBJ + loadFinished = false; + if (url.toString() == QLatin1String("help")) { + load(QUrl(QLatin1String("qthelp://com.trolltech.com." + "assistantinternal-1.0.0/assistant/assistant.html"))); + } else { + load(url); + } } void HelpViewer::home() @@ -325,16 +354,12 @@ void HelpViewer::home() void HelpViewer::wheelEvent(QWheelEvent *e) { TRACE_OBJ - if (e->modifiers() & Qt::ControlModifier) { - const int delta = e->delta(); - if (delta > 0) - zoomIn(delta / 120); - else if (delta < 0) - zoomOut(-delta / 120); + if (e->modifiers()& Qt::ControlModifier) { e->accept(); - return; + e->delta() > 0 ? scaleUp() : scaleDown(); + } else { + QWebView::wheelEvent(e); } - QWebView::wheelEvent(e); } void HelpViewer::mouseReleaseEvent(QMouseEvent *e) diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h index 4daa869..3f2e537 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.h +++ b/tools/assistant/tools/assistant/helpviewer_qwv.h @@ -59,11 +59,19 @@ class HelpViewer : public QWebView, public AbstractHelpViewer Q_OBJECT public: - HelpViewer(CentralWidget *parent); - void setSource(const QUrl &url); + HelpViewer(CentralWidget *parent, qreal zoom = 0.0); + ~HelpViewer(); + + QFont viewerFont() const; + void setViewerFont(const QFont &font); - inline QUrl source() const - { return url(); } + void scaleUp(); + void scaleDown(); + void resetScale(); + qreal scale() const { return textSizeMultiplier(); } + + void setSource(const QUrl &url); + inline QUrl source() const { return url(); } inline QString documentTitle() const { return title(); } @@ -71,10 +79,6 @@ public: inline bool hasSelection() const { return !selectedText().isEmpty(); } // ### this is suboptimal - void resetZoom(); - void zoomIn(qreal range = 1); - void zoomOut(qreal range = 1); - inline void copy() { return triggerPageAction(QWebPage::Copy); } @@ -84,8 +88,6 @@ public: { return pageAction(QWebPage::Back)->isEnabled(); } inline bool hasLoadFinished() const { return loadFinished; } - inline qreal zoom() const - { return textSizeMultiplier(); } public Q_SLOTS: void home(); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 086f9eb..4115d39 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -759,12 +759,10 @@ void MainWindow::showPreferences() { TRACE_OBJ PreferencesDialog dia(this); - connect(&dia, SIGNAL(updateApplicationFont()), this, SLOT(updateApplicationFont())); connect(&dia, SIGNAL(updateBrowserFont()), m_centralWidget, SLOT(updateBrowserFont())); - dia.showDialog(); } @@ -969,7 +967,9 @@ void MainWindow::updateApplicationFont() if (helpEngine.usesAppFont()) font = helpEngine.appFont(); - qApp->setFont(font, "QWidget"); + const QWidgetList &widgets = qApp->allWidgets(); + foreach (QWidget* widget, widgets) + widget->setFont(font); } void MainWindow::setupFilterCombo() diff --git a/tools/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp index f0ef054..0e1d719 100644 --- a/tools/assistant/tools/assistant/preferencesdialog.cpp +++ b/tools/assistant/tools/assistant/preferencesdialog.cpp @@ -38,26 +38,24 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "tracer.h" - #include "preferencesdialog.h" + +#include "centralwidget.h" #include "filternamedialog.h" -#include "installdialog.h" #include "fontpanel.h" -#include "centralwidget.h" -#include "aboutdialog.h" #include "helpenginewrapper.h" +#include "installdialog.h" +#include "tracer.h" #include <QtCore/QtAlgorithms> #include <QtCore/QFileSystemWatcher> -#include <QtGui/QHeaderView> +#include <QtGui/QDesktopWidget> #include <QtGui/QFileDialog> -#include <QtGui/QMessageBox> -#include <QtGui/QMenu> #include <QtGui/QFontDatabase> -#include <QtGui/QApplication> -#include <QtGui/QDesktopWidget> +#include <QtGui/QHeaderView> +#include <QtGui/QMenu> +#include <QtGui/QMessageBox> #include <QtHelp/QHelpEngineCore> @@ -115,6 +113,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) updateFontSettingsPage(); updateOptionsPage(); + + if (helpEngine.usesAppFont()) + setFont(helpEngine.appFont()); } PreferencesDialog::~PreferencesDialog() @@ -124,16 +125,13 @@ PreferencesDialog::~PreferencesDialog() 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()); - } - - if (m_appFontChanged || m_browserFontChanged) { - emit updateApplicationFont(); emit updateBrowserFont(); } |