mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
WebScrollBarCornerWidget: Draw using QStyle::PE_PanelScrollAreaCorner
This commit is contained in:
parent
e656e92eaf
commit
e10294db6d
@ -28,16 +28,19 @@
|
||||
#include <QPaintEvent>
|
||||
#include <QWebEngineProfile>
|
||||
#include <QWebEngineScriptCollection>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user