Change highlight color in QWebView

I want to change the color in which the text is highlighted when using the findText () method. This color has nothing to do with the user-selected text. I tried CSS and also installed QPalette. All occurrences are always highlighted in yellow.

+3


source to share


2 answers


I was looking for this too, and it seems hardcoded deep inside WebKit:



Color RenderTheme::platformInactiveTextSearchHighlightColor() const
{
    return Color(255, 255, 0); // Yellow.
}

      

+1


source


I actually have the same problem. But the good news is that setting the stylesheet helps at least change the fg / bk color.

m_browser->setStyleSheet("QWebView { 
    selection-background-color: blue; selection-color: white; }");

      



But this is not the whole truth, because it only changes the fg / bk color of the currently found text. Not sure how to change the fg / bk color of all occurrences.

Axel

0


source







All Articles