From acbdd0edc3131a90ffaf6948dd2d02f06918843b Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Tue, 13 Oct 2015 18:06:51 +0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/usermanual.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qt-ui/usermanual.cpp') 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()) { -- cgit v1.2.3-70-g09d2