From e10294db6d7b9a5b2c4bf2bcbba0a0e88f33727f Mon Sep 17 00:00:00 2001 From: David Rosca Date: Thu, 26 Jan 2017 21:13:57 +0100 Subject: [PATCH] WebScrollBarCornerWidget: Draw using QStyle::PE_PanelScrollAreaCorner --- src/lib/webengine/webscrollbarmanager.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/webengine/webscrollbarmanager.cpp b/src/lib/webengine/webscrollbarmanager.cpp index 9cc581cc5..3c7e80572 100644 --- a/src/lib/webengine/webscrollbarmanager.cpp +++ b/src/lib/webengine/webscrollbarmanager.cpp @@ -28,16 +28,19 @@ #include #include #include +#include +#include Q_GLOBAL_STATIC(WebScrollBarManager, qz_web_scrollbar_manager) -class WebScrollBarCornerWidget : QWidget +class WebScrollBarCornerWidget : public QWidget { public: explicit WebScrollBarCornerWidget(WebView *view) : QWidget() , m_view(view) { + setAutoFillBackground(true); } void updateVisibility(bool visible, int thickness) @@ -55,9 +58,14 @@ public: private: void paintEvent(QPaintEvent *ev) override { - QPainter painter(this); - painter.fillRect(ev->rect(), m_view->page()->backgroundColor()); - QWidget::paintEvent(ev); + Q_UNUSED(ev) + + QStyleOption option; + option.initFrom(this); + option.rect = rect(); + + QPainter p(this); + style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); } WebView *m_view;