diff --git a/src/libs/qlitehtml b/src/libs/qlitehtml
index 8e541a22b51..b8f6617f22a 160000
--- a/src/libs/qlitehtml
+++ b/src/libs/qlitehtml
@@ -1 +1 @@
-Subproject commit 8e541a22b513432ed566fca824af207395ee0c90
+Subproject commit b8f6617f22a7bd0bf3da2e75d1613e1346b974f0
diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp
index d5f5756ed69..6337bafd11e 100644
--- a/src/plugins/help/generalsettingspage.cpp
+++ b/src/plugins/help/generalsettingspage.cpp
@@ -18,6 +18,7 @@
#include
#include
+#include
#include
#include
@@ -76,6 +77,7 @@ private:
QFontComboBox *familyComboBox;
QComboBox *styleComboBox;
QComboBox *sizeComboBox;
+ QCheckBox *antialiasCheckBox;
QLineEdit *homePageLineEdit;
QComboBox *helpStartComboBox;
QComboBox *contextHelpComboBox;
@@ -92,49 +94,31 @@ private:
GeneralSettingsPageWidget::GeneralSettingsPageWidget()
{
+ using namespace Layouting;
+
// font group box
- auto fontGroupBox = new QGroupBox(Tr::tr("Font"));
- auto familyLabel = new QLabel(Tr::tr("Family:"));
-
familyComboBox = new QFontComboBox;
- auto styleLabel = new QLabel(Tr::tr("Style:"));
styleComboBox = new QComboBox;
- auto sizeLabel = new QLabel(Tr::tr("Size:"));
sizeComboBox = new QComboBox;
-
- auto fontLayout = new QHBoxLayout();
- fontLayout->addWidget(familyComboBox);
- fontLayout->addSpacing(20);
- fontLayout->addWidget(styleLabel);
- fontLayout->addWidget(styleComboBox);
- fontLayout->addSpacing(20);
- fontLayout->addWidget(sizeLabel);
- fontLayout->addWidget(sizeComboBox);
- fontLayout->addStretch();
-
- auto noteLabel = new QLabel(Tr::tr(
- "Note: The above setting takes effect only if the HTML file does not use a style sheet."));
- noteLabel->setWordWrap(true);
- auto zoomLabel = new QLabel(Tr::tr("Zoom:"));
-
zoomSpinBox = new QSpinBox;
zoomSpinBox->setMinimum(10);
zoomSpinBox->setMaximum(3000);
zoomSpinBox->setSingleStep(10);
zoomSpinBox->setValue(100);
zoomSpinBox->setSuffix(Tr::tr("%"));
+ antialiasCheckBox = new QCheckBox(Tr::tr("Antialias"));
- auto zoomLayout = new QHBoxLayout();
- zoomLayout->addWidget(zoomSpinBox);
- zoomLayout->addStretch();
-
- auto fontGroupBoxLayout = new QGridLayout;
- fontGroupBox->setLayout(fontGroupBoxLayout);
- fontGroupBoxLayout->addWidget(familyLabel, 0, 0);
- fontGroupBoxLayout->addLayout(fontLayout, 0, 1);
- fontGroupBoxLayout->addWidget(noteLabel, 1, 0, 1, 2);
- fontGroupBoxLayout->addWidget(zoomLabel, 2, 0);
- fontGroupBoxLayout->addLayout(zoomLayout, 2, 1);
+ auto fontGroupBox = new QGroupBox(Tr::tr("Font"));
+ // clang-format off
+ Column {
+ Row { Tr::tr("Family:"), familyComboBox,
+ Tr::tr("Style:"), styleComboBox,
+ Tr::tr("Size:"), sizeComboBox, st },
+ Row { Tr::tr("Note: The above setting takes effect only if the "
+ "HTML file does not use a style sheet.") },
+ Row { Tr::tr("Zoom:"), zoomSpinBox, antialiasCheckBox, st }
+ }.attachTo(fontGroupBox);
+ // clang-format on
// startup group box
auto startupGroupBox = new QGroupBox(Tr::tr("Startup"));
@@ -231,6 +215,7 @@ GeneralSettingsPageWidget::GeneralSettingsPageWidget()
m_font = LocalHelpManager::fallbackFont();
m_fontZoom = LocalHelpManager::fontZoom();
zoomSpinBox->setValue(m_fontZoom);
+ antialiasCheckBox->setChecked(LocalHelpManager::antialias());
updateFontSizeSelector();
updateFontStyleSelector();
@@ -309,6 +294,8 @@ void GeneralSettingsPageWidget::apply()
if (m_fontZoom != LocalHelpManager::fontZoom())
LocalHelpManager::setFontZoom(m_fontZoom);
+ LocalHelpManager::setAntialias(antialiasCheckBox->isChecked());
+
QString homePage = QUrl::fromUserInput(homePageLineEdit->text()).toString();
if (homePage.isEmpty())
homePage = Help::Constants::AboutBlank;
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index a3c31c5c6be..0b3ad2f011c 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -374,6 +374,13 @@ HelpViewer *HelpPlugin::createHelpViewer()
connect(LocalHelpManager::instance(), &LocalHelpManager::fontZoomChanged,
viewer, &HelpViewer::setFontZoom);
+ // initialize antialias
+ viewer->setAntialias(LocalHelpManager::antialias());
+ connect(LocalHelpManager::instance(),
+ &LocalHelpManager::antialiasChanged,
+ viewer,
+ &HelpViewer::setAntialias);
+
viewer->setScrollWheelZoomingEnabled(LocalHelpManager::isScrollWheelZoomingEnabled());
connect(LocalHelpManager::instance(), &LocalHelpManager::scrollWheelZoomingEnabledChanged,
viewer, &HelpViewer::setScrollWheelZoomingEnabled);
diff --git a/src/plugins/help/helpviewer.cpp b/src/plugins/help/helpviewer.cpp
index e10c65a019b..323d9d3f854 100644
--- a/src/plugins/help/helpviewer.cpp
+++ b/src/plugins/help/helpviewer.cpp
@@ -71,6 +71,8 @@ HelpViewer::~HelpViewer()
restoreOverrideCursor();
}
+void HelpViewer::setAntialias(bool) {}
+
void HelpViewer::setFontZoom(int percentage)
{
setScale(percentage / 100.0);
diff --git a/src/plugins/help/helpviewer.h b/src/plugins/help/helpviewer.h
index c05685794d6..503e06db35a 100644
--- a/src/plugins/help/helpviewer.h
+++ b/src/plugins/help/helpviewer.h
@@ -32,6 +32,7 @@ public:
~HelpViewer() override;
virtual void setViewerFont(const QFont &font) = 0;
+ virtual void setAntialias(bool on);
virtual void setScale(qreal scale) = 0;
diff --git a/src/plugins/help/litehtmlhelpviewer.cpp b/src/plugins/help/litehtmlhelpviewer.cpp
index 59df62ba666..af4b84c5fcb 100644
--- a/src/plugins/help/litehtmlhelpviewer.cpp
+++ b/src/plugins/help/litehtmlhelpviewer.cpp
@@ -134,6 +134,11 @@ void LiteHtmlHelpViewer::setScale(qreal scale)
m_viewer->setZoomFactor(scale == 0 ? qreal(1) : scale);
}
+void LiteHtmlHelpViewer::setAntialias(bool on)
+{
+ m_viewer->setAntialias(on);
+}
+
QString LiteHtmlHelpViewer::title() const
{
return m_viewer->title();
diff --git a/src/plugins/help/litehtmlhelpviewer.h b/src/plugins/help/litehtmlhelpviewer.h
index 82f5d89e483..0978bca9b20 100644
--- a/src/plugins/help/litehtmlhelpviewer.h
+++ b/src/plugins/help/litehtmlhelpviewer.h
@@ -24,8 +24,8 @@ public:
~LiteHtmlHelpViewer() override;
void setViewerFont(const QFont &font) override;
-
void setScale(qreal scale) override;
+ void setAntialias(bool on) final;
QString title() const override;
diff --git a/src/plugins/help/localhelpmanager.cpp b/src/plugins/help/localhelpmanager.cpp
index e8be2bfbe32..d17a3e83949 100644
--- a/src/plugins/help/localhelpmanager.cpp
+++ b/src/plugins/help/localhelpmanager.cpp
@@ -52,21 +52,23 @@ QHelpEngine* LocalHelpManager::m_guiEngine = nullptr;
QMutex LocalHelpManager::m_bkmarkMutex;
BookmarkManager* LocalHelpManager::m_bookmarkManager = nullptr;
-static const char kHelpHomePageKey[] = "Help/HomePage";
-static const char kFontFamilyKey[] = "Help/FallbackFontFamily";
-static const char kFontStyleNameKey[] = "Help/FallbackFontStyleName";
-static const char kFontSizeKey[] = "Help/FallbackFontSize";
-static const char kFontZoomKey[] = "Help/FontZoom";
-static const char kStartOptionKey[] = "Help/StartOption";
-static const char kContextHelpOptionKey[] = "Help/ContextHelpOption";
-static const char kReturnOnCloseKey[] = "Help/ReturnOnClose";
-static const char kUseScrollWheelZooming[] = "Help/UseScrollWheelZooming";
-static const char kLastShownPagesKey[] = "Help/LastShownPages";
-static const char kLastSelectedTabKey[] = "Help/LastSelectedTab";
-static const char kViewerBackend[] = "Help/ViewerBackend";
+const char kHelpHomePageKey[] = "Help/HomePage";
+const char kFontFamilyKey[] = "Help/FallbackFontFamily";
+const char kFontStyleNameKey[] = "Help/FallbackFontStyleName";
+const char kFontSizeKey[] = "Help/FallbackFontSize";
+const char kFontZoomKey[] = "Help/FontZoom";
+const char kAntialiasKey[] = "Help/FontAntialias";
+const char kStartOptionKey[] = "Help/StartOption";
+const char kContextHelpOptionKey[] = "Help/ContextHelpOption";
+const char kReturnOnCloseKey[] = "Help/ReturnOnClose";
+const char kUseScrollWheelZooming[] = "Help/UseScrollWheelZooming";
+const char kLastShownPagesKey[] = "Help/LastShownPages";
+const char kLastSelectedTabKey[] = "Help/LastSelectedTab";
+const char kViewerBackend[] = "Help/ViewerBackend";
-static const int kDefaultFallbackFontSize = 14;
-static const int kDefaultFontZoom = 100;
+const int kDefaultFallbackFontSize = 14;
+const int kDefaultFontZoom = 100;
+const bool kDefaultAntialias = true;
const int kDefaultStartOption = LocalHelpManager::ShowLastPages;
const int kDefaultContextHelpOption = Core::HelpManager::SideBySideIfPossible;
const bool kDefaultReturnOnClose = false;
@@ -175,6 +177,19 @@ int LocalHelpManager::setFontZoom(int percentage)
return newZoom;
}
+bool LocalHelpManager::antialias()
+{
+ return Core::ICore::settings()->value(kAntialiasKey, kDefaultAntialias).toBool();
+}
+
+void LocalHelpManager::setAntialias(bool on)
+{
+ if (on != antialias()) {
+ Core::ICore::settings()->setValueWithDefault(kAntialiasKey, on, kDefaultAntialias);
+ emit m_instance->antialiasChanged(on);
+ }
+}
+
LocalHelpManager::StartOption LocalHelpManager::startOption()
{
const QVariant value = Core::ICore::settings()->value(kStartOptionKey, kDefaultStartOption);
diff --git a/src/plugins/help/localhelpmanager.h b/src/plugins/help/localhelpmanager.h
index 433d1ce7663..5195e7f1b70 100644
--- a/src/plugins/help/localhelpmanager.h
+++ b/src/plugins/help/localhelpmanager.h
@@ -61,6 +61,9 @@ public:
static int fontZoom();
static int setFontZoom(int percentage);
+ static bool antialias();
+ static void setAntialias(bool on);
+
static StartOption startOption();
static void setStartOption(StartOption option);
@@ -104,6 +107,7 @@ public:
signals:
void fallbackFontChanged(const QFont &font);
void fontZoomChanged(int percentage);
+ void antialiasChanged(bool on);
void returnOnCloseChanged();
void scrollWheelZoomingEnabledChanged(bool enabled);
void contextHelpOptionChanged(Core::HelpManager::HelpViewerLocation option);
diff --git a/src/plugins/help/textbrowserhelpviewer.cpp b/src/plugins/help/textbrowserhelpviewer.cpp
index d2b37dd87d2..419dfb93595 100644
--- a/src/plugins/help/textbrowserhelpviewer.cpp
+++ b/src/plugins/help/textbrowserhelpviewer.cpp
@@ -55,22 +55,28 @@ TextBrowserHelpViewer::~TextBrowserHelpViewer() = default;
void TextBrowserHelpViewer::setViewerFont(const QFont &newFont)
{
- setFontAndScale(newFont, LocalHelpManager::fontZoom() / 100.0);
+ setFontAndScale(newFont, LocalHelpManager::fontZoom() / 100.0, LocalHelpManager::antialias());
}
-void TextBrowserHelpViewer::setFontAndScale(const QFont &font, qreal scale)
+void TextBrowserHelpViewer::setFontAndScale(const QFont &font, qreal scale, bool antialias)
{
- m_textBrowser->withFixedTopPosition([this, &font, scale] {
+ m_textBrowser->withFixedTopPosition([this, &font, scale, antialias] {
QFont newFont = font;
const float newSize = font.pointSizeF() * scale;
newFont.setPointSizeF(newSize);
+ newFont.setStyleStrategy(antialias ? QFont::PreferAntialias : QFont::NoAntialias);
m_textBrowser->setFont(newFont);
});
}
void TextBrowserHelpViewer::setScale(qreal scale)
{
- setFontAndScale(LocalHelpManager::fallbackFont(), scale);
+ setFontAndScale(LocalHelpManager::fallbackFont(), scale, LocalHelpManager::antialias());
+}
+
+void TextBrowserHelpViewer::setAntialias(bool on)
+{
+ setFontAndScale(LocalHelpManager::fallbackFont(), LocalHelpManager::fontZoom() / 100.0, on);
}
QString TextBrowserHelpViewer::title() const
diff --git a/src/plugins/help/textbrowserhelpviewer.h b/src/plugins/help/textbrowserhelpviewer.h
index 59994539274..2177cf55c0c 100644
--- a/src/plugins/help/textbrowserhelpviewer.h
+++ b/src/plugins/help/textbrowserhelpviewer.h
@@ -22,8 +22,8 @@ public:
~TextBrowserHelpViewer() override;
void setViewerFont(const QFont &font) override;
-
void setScale(qreal scale) override;
+ void setAntialias(bool on) final;
QString title() const override;
@@ -48,7 +48,7 @@ public:
void print(QPrinter *printer) override;
private:
- void setFontAndScale(const QFont &font, qreal scale);
+ void setFontAndScale(const QFont &font, qreal scale, bool antialias);
TextBrowserHelpWidget *m_textBrowser;
};