Alkimia API

alkwebview.h
1/*
2 SPDX-FileCopyrightText: 2018, 2024 Ralf Habacker ralf.habacker @freenet.de
3
4 This file is part of libalkimia.
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#ifndef ALKWEBVIEW_H
10#define ALKWEBVIEW_H
11
12#include <alkimia/alk_export.h>
13
14#if defined(BUILD_WITH_WEBENGINE)
15
16#include <QWebEngineView>
17
18class AlkWebPage;
19
20/**
21 * The AlkWebView class provides a widget that
22 * is used to load and display web documents.
23 *
24 * @author Ralf Habacker ralf.habacker @freenet.de
25 */
26class ALK_EXPORT AlkWebView : public QWebEngineView
27{
28 Q_OBJECT
29public:
30 explicit AlkWebView(QWidget *parent = nullptr);
31 virtual ~AlkWebView();
32
33 void load(const QUrl &url);
34 static void setWebInspectorEnabled(bool state);
35 static bool webInspectorEnabled();
36 AlkWebPage *webPage();
37 void setWebPage(AlkWebPage *webPage);
38
39Q_SIGNALS:
40 void loadRedirectedTo(const QUrl &url);
41
42protected:
43 void contextMenuEvent(QContextMenuEvent *event) override;
44};
45
46#elif defined(BUILD_WITH_WEBKIT)
47
48#include <QWebView>
49
50class AlkWebPage;
51
52/**
53 * The AlkWebView class provides a widget that
54 * is used to load and display web documents.
55 *
56 * @author Ralf Habacker ralf.habacker @freenet.de
57 */
58class ALK_EXPORT AlkWebView : public QWebView
59{
60 Q_OBJECT
61public:
62 explicit AlkWebView(QWidget *parent = nullptr);
63 virtual ~AlkWebView();
64
65 void setWebInspectorEnabled(bool enable);
66 bool webInspectorEnabled();
67 AlkWebPage *webPage();
68 void setWebPage(AlkWebPage *webPage);
69
70Q_SIGNALS:
71 void loadRedirectedTo(const QUrl &url);
72};
73
74#else
75
76#include <QTextBrowser>
77
78class AlkWebPage;
79
80/**
81 * The AlkWebView class provides a widget that
82 * is used to load and display web documents.
83 *
84 * @author Ralf Habacker ralf.habacker @freenet.de
85 */
86class ALK_EXPORT AlkWebView : public QTextBrowser
87{
88 Q_OBJECT
89public:
90 explicit AlkWebView(QWidget *parent = nullptr);
91 virtual ~AlkWebView();
92
93 void load(const QUrl &url);
94 void setHtml(const QString &data, const QUrl &baseUrl);
95 void setUrl(const QUrl &url);
96 void setWebInspectorEnabled(bool enable);
97 bool webInspectorEnabled();
98 AlkWebPage *webPage();
99 void setWebPage(AlkWebPage *webPage);
100
101Q_SIGNALS:
102 void loadStarted();
103 void loadFinished(bool);
104 void loadRedirectedTo(const QUrl &to);
105
106private:
107 AlkWebPage *m_page{nullptr};
108 QVariant loadResource(int type, const QUrl &name) override;
109};
110#endif
111
112#endif // ALKWEBVIEW_H
The AlkWebPage class provides an object to load and view web documents to provide functionality like ...
Definition alkwebpage.h:100
The AlkWebView class provides a widget that is used to load and display web documents.
Definition alkwebview.h:87
QAction * load(const QObject *recvr, const char *slot, QObject *parent)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.