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>
This commit is contained in:
Lubomir I. Ivanov 2015-10-13 18:06:51 +03:00 committed by Dirk Hohndel
parent 313f76542e
commit acbdd0edc3

View file

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