Messagelib

webenginepage.h
1 /*
2  SPDX-FileCopyrightText: 2016-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "webengineviewer_export.h"
10 #include <QWebEnginePage>
11 class QWebEngineProfile;
12 class QWebEngineDownloadItem;
13 class QPrinter;
14 namespace WebEngineViewer
15 {
16 class WebHitTest;
17 /**
18  * @brief The WebEnginePage class
19  * @author Laurent Montel <[email protected]>
20  */
21 class WEBENGINEVIEWER_EXPORT WebEnginePage : public QWebEnginePage
22 {
23  Q_OBJECT
24 public:
25  /**
26  * Constructor.
27  *
28  * A private QWebEngineProfile, only applying to this QWebEnginePage,
29  * will be created to implement browser settings. It can be accessed via
30  * @c profile(), but it should not be shared or reused unless care is
31  * taken that the profile is not deleted until all of the QWebEnginePage's
32  * belonging to it are deleted first.
33  *
34  * @param parent The parent object
35  **/
36  explicit WebEnginePage(QObject *parent = nullptr);
37 
38  /**
39  * Constructor.
40  *
41  * The specified QWebEngineProfile will be used. See the description of
42  * @c WebEnginePage(QObject *) and the API documentation of QWebEnginePage
43  * for caution regarding the lifetime of the profile.
44  *
45  * @param profile The profile to be used
46  * @param parent The parent object
47  * @deprecated Use the single argument constructor, which creates and uses
48  * a private profile.
49  **/
50 #ifndef WEBENGINEVIEWER_NO_DEPRECATED
51  explicit WEBENGINEVIEWER_DEPRECATED WebEnginePage(QWebEngineProfile *profile, QObject *parent = nullptr);
52 #endif
53 
54  /**
55  * Destructor. If there is a private QWebEngineProfile then it will also
56  * be destroyed.
57  **/
58  ~WebEnginePage() override = default;
59 
60  WebEngineViewer::WebHitTest *hitTestContent(const QPoint &pos);
61 
62  void saveHtml(QWebEngineDownloadItem *download);
63  Q_REQUIRED_RESULT bool execPrintPreviewPage(QPrinter *printer, int timeout);
64 
65  Q_REQUIRED_RESULT QPoint mapToViewport(const QPoint &pos) const;
66 Q_SIGNALS:
67  void urlClicked(const QUrl &url);
68  void showConsoleMessage(const QString &message);
69 
70 protected:
71  bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override;
72  void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID) override;
73 
74 private:
75  void init();
76 };
77 }
78 
The WebEnginePage class.
Definition: webenginepage.h:21
The WebHitTest class.
Definition: webhittest.h:22
PartitionTable::TableType type
QCA_EXPORT void init()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 23:04:59 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.