Messagelib

webenginepage.h
1/*
2 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "webengineviewer_export.h"
10#include <QWebEnginePage>
11class QWebEngineProfile;
12class QWebEngineDownloadRequest;
13namespace WebEngineViewer
14{
15class WebHitTest;
16/**
17 * @brief The WebEnginePage class
18 * @author Laurent Montel <montel@kde.org>
19 */
20class WEBENGINEVIEWER_EXPORT WebEnginePage : public QWebEnginePage
21{
22 Q_OBJECT
23public:
24 /**
25 * Constructor.
26 *
27 * A private QWebEngineProfile, only applying to this QWebEnginePage,
28 * will be created to implement browser settings. It can be accessed via
29 * @c profile(), but it should not be shared or reused unless care is
30 * taken that the profile is not deleted until all of the QWebEnginePage's
31 * belonging to it are deleted first.
32 *
33 * @param parent The parent object
34 **/
35 explicit WebEnginePage(QObject *parent = nullptr);
36 /**
37 * Destructor. If there is a private QWebEngineProfile then it will also
38 * be destroyed.
39 **/
40 ~WebEnginePage() override;
41
42 [[nodiscard]] WebEngineViewer::WebHitTest *hitTestContent(const QPoint &pos);
43
44 void saveHtml(QWebEngineDownloadRequest *download);
45
46 [[nodiscard]] QPoint mapToViewport(const QPoint &pos) const;
47Q_SIGNALS:
48 void urlClicked(const QUrl &url);
49 void showConsoleMessage(const QString &message);
50
51protected:
52 [[nodiscard]] bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override;
53 void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID) override;
54 [[nodiscard]] bool eventFilter(QObject *obj, QEvent *event) override;
55 [[nodiscard]] QString refreshCssVariablesScript();
56
57private:
58 WEBENGINEVIEWER_NO_EXPORT void init();
59 class Private;
60 std::unique_ptr<Private> d;
61};
62}
The WebEnginePage class.
~WebEnginePage() override
Destructor.
The WebHitTest class.
Definition webhittest.h:23
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:48:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.