mirror of
https://gitee.com/spark-store-project/spark-web-app-runtime.git
synced 2025-07-03 20:26:02 +08:00
使用自定义 webkit 滚动条,避免 QWebEngineView 原生滚动条显示(仅在 QWebEnginePage 加载时生效,部分页面动态刷新时滚动条样式不生效) Log: 使用自定义 webkit 滚动条
30 lines
502 B
C++
30 lines
502 B
C++
#ifndef WEBENGINEPAGE_H
|
|
#define WEBENGINEPAGE_H
|
|
|
|
#include <QWebEnginePage>
|
|
|
|
class WebEnginePage : public QWebEnginePage
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit WebEnginePage(QObject *parent = nullptr);
|
|
~WebEnginePage() override;
|
|
|
|
void setUrl(const QUrl &url);
|
|
|
|
protected:
|
|
QWebEnginePage *createWindow(WebWindowType type) override;
|
|
|
|
private:
|
|
void initScrollBarStyle();
|
|
|
|
private slots:
|
|
void slotUrlChanged(const QUrl &url);
|
|
|
|
private:
|
|
QUrl m_currentUrl;
|
|
};
|
|
|
|
#endif // WEBENGINEPAGE_H
|