webview.h

#ifndef WEBVIEW_H
#define WEBVIEW_H

#include <QIcon>
#include <QWebEngineView>

class WebPage;

class WebView : public QWebEngineView
{
    Q_OBJECT

public:
    WebView(QWidget *parent = nullptr);
    void setPage(WebPage *page);

    QIcon icon() const;
    int loadProgress() const;
    bool isWebActionEnabled(QWebEnginePage::WebAction webAction) const;
    static QNetworkAccessManager &networkAccessManager();

protected:
    void contextMenuEvent(QContextMenuEvent *event) override;
    QWebEngineView *createWindow(QWebEnginePage::WebWindowType type) override;

signals:
    void iconChanged(const QIcon &icon);
    void webActionEnabledChanged(QWebEnginePage::WebAction webAction, bool enabled);

private slots:
    void handleIconUrlChanged(const QUrl &url);
    void handleIconLoaded();

private:
    void createWebActionTrigger(QWebEnginePage *page, QWebEnginePage::WebAction);

private:
    int m_loadProgress;
    QIcon m_icon;
};

#endif
阅读更多
个人分类: qt
上一篇webpopupwindow.cpp
下一篇webview.cpp
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭