summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-10-13 18:06:51 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-13 08:18:51 -0700
commitacbdd0edc3131a90ffaf6948dd2d02f06918843b (patch)
tree57317babb11cfc25a4e1105ba3dd4fd0c5a7b6fd /qt-ui
parent313f76542ec80187151d877d556e1d8723737790 (diff)
downloadsubsurface-acbdd0edc3131a90ffaf6948dd2d02f06918843b.tar.gz
usermanual.cpp: use default QWidget theme colors for text selections
The default selection text/background colors (also when seaching) are black/light-grey in QWebView, for some reason. To solve the issue we pass a stylesheet that makes use of the default palette's highlight() and highlightedText() from QWidget. Fixes #797 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/usermanual.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/usermanual.cpp b/qt-ui/usermanual.cpp
index 6bbfb79e5..6b676f16b 100644
--- a/qt-ui/usermanual.cpp
+++ b/qt-ui/usermanual.cpp
@@ -54,8 +54,11 @@ UserManual::UserManual(QWidget *parent) : QWidget(parent)
setWindowTitle(tr("User manual"));
setWindowIcon(QIcon(":/subsurface-icon"));
-
userManual = new QWebView(this);
+ QString colorBack = palette().highlight().color().name(QColor::HexRgb);
+ QString colorText = palette().highlightedText().color().name(QColor::HexRgb);
+ userManual->setStyleSheet(QString("QWebView { selection-background-color: %1; selection-color: %2; }")
+ .arg(colorBack).arg(colorText));
userManual->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
QString searchPath = getSubsurfaceDataPath("Documentation");
if (searchPath.size()) {