mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
WebScrollBarCornerWidget: Draw using QStyle::PE_PanelScrollAreaCorner
This commit is contained in:
parent
e656e92eaf
commit
e10294db6d
|
@ -28,16 +28,19 @@
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QWebEngineProfile>
|
#include <QWebEngineProfile>
|
||||||
#include <QWebEngineScriptCollection>
|
#include <QWebEngineScriptCollection>
|
||||||
|
#include <QStyle>
|
||||||
|
#include <QStyleOption>
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(WebScrollBarManager, qz_web_scrollbar_manager)
|
Q_GLOBAL_STATIC(WebScrollBarManager, qz_web_scrollbar_manager)
|
||||||
|
|
||||||
class WebScrollBarCornerWidget : QWidget
|
class WebScrollBarCornerWidget : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit WebScrollBarCornerWidget(WebView *view)
|
explicit WebScrollBarCornerWidget(WebView *view)
|
||||||
: QWidget()
|
: QWidget()
|
||||||
, m_view(view)
|
, m_view(view)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateVisibility(bool visible, int thickness)
|
void updateVisibility(bool visible, int thickness)
|
||||||
|
@ -55,9 +58,14 @@ public:
|
||||||
private:
|
private:
|
||||||
void paintEvent(QPaintEvent *ev) override
|
void paintEvent(QPaintEvent *ev) override
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
Q_UNUSED(ev)
|
||||||
painter.fillRect(ev->rect(), m_view->page()->backgroundColor());
|
|
||||||
QWidget::paintEvent(ev);
|
QStyleOption option;
|
||||||
|
option.initFrom(this);
|
||||||
|
option.rect = rect();
|
||||||
|
|
||||||
|
QPainter p(this);
|
||||||
|
style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebView *m_view;
|
WebView *m_view;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user