RESOLVED INVALID 26045
The Qt Style Sheets are not applied on webkit scrollbars
https://bugs.webkit.org/show_bug.cgi?id=26045
Summary The Qt Style Sheets are not applied on webkit scrollbars
Vincent Ordy
Reported 2009-05-27 13:44:31 PDT
The Qt Style Sheets set with setStyleSheet() on the QWebView are not applied on webkit scroll bars. It seems to happen because of the QStyleSheetStyleSelector::attribute() and QStyleSheetStyleSelector::nodeNames() functions used by StyleSelector::styleRulesForNode(). They both use the widget metadata to get the widget type name and properties in order to find out which rules to apply. A quick fix is to have ScrollbarThemeQt inherit from QScrollbar and use "this" as widget for drawComplexControl(). - p.drawComplexControl(QStyle::CC_ScrollBar, *opt); + p.style->drawComplexControl(QStyle::CC_ScrollBar, opt, p.painter, this);
Attachments
Testcase (1.02 KB, application/x-bzip2)
2010-03-10 15:25 PST, Vincent Ordy
no flags
Kent Hansen
Comment 1 2010-03-10 07:40:06 PST
Please provide a testcase (in the form of a compileable Qt app, for example).
Vincent Ordy
Comment 2 2010-03-10 15:25:58 PST
Created attachment 50446 [details] Testcase
Vincent Ordy
Comment 3 2010-03-10 15:40:11 PST
This testcase creates 2 windows. Both have a QScrollArea which contains a QWebView. I do setStyleSheet("QScrollBar { background: blue; }") on both windows. The style of the first is QWindowsStyle, and the second's is QMotifStyle. The QWebView scrollbar does use the style set by setStyle. However, it does not use the one set by setStyleSheet("QScrollBar {...}"). Like I said before, it happens because the Qt Style Sheets system uses metadata to find out the type of an object. Since a ScrollbarThemeQt is not a QScrollbar, the style sheet for QScrollbar is not used.
Kent Hansen
Comment 4 2010-03-12 03:23:47 PST
(In reply to comment #3) > This testcase creates 2 windows. Both have a QScrollArea which contains a > QWebView. I do setStyleSheet("QScrollBar { background: blue; }") on both > windows. > > The style of the first is QWindowsStyle, and the second's is QMotifStyle. The > QWebView scrollbar does use the style set by setStyle. > > However, it does not use the one set by setStyleSheet("QScrollBar {...}"). Like > I said before, it happens because the Qt Style Sheets system uses metadata to > find out the type of an object. Since a ScrollbarThemeQt is not a QScrollbar, > the style sheet for QScrollbar is not used. Thanks for the testcase. Hmm, with r33755 and Qt 4.6 trunk the QWebView scrollbars don't even respect setStyle()! It did in an older version, like you said, so this is a regression.
Kent Hansen
Comment 5 2010-03-12 03:24:37 PST
(In reply to comment #4) > Hmm, with r33755 and Qt 4.6 trunk Sorry, that should be r55658.
Jocelyn Turcotte
Comment 6 2014-02-03 03:50:33 PST
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it. If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.
Note You need to log in before you can comment on or make changes to this bug.