diff options
Diffstat (limited to 'src/core/api/qwebenginepage.h')
-rw-r--r-- | src/core/api/qwebenginepage.h | 115 |
1 files changed, 57 insertions, 58 deletions
diff --git a/src/core/api/qwebenginepage.h b/src/core/api/qwebenginepage.h index 1bdcf6539..c857585ab 100644 --- a/src/core/api/qwebenginepage.h +++ b/src/core/api/qwebenginepage.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWEBENGINEPAGE_H #define QWEBENGINEPAGE_H @@ -43,44 +7,51 @@ #include <QtWebEngineCore/qtwebenginecoreglobal.h> #include <QtWebEngineCore/qwebengineclientcertificateselection.h> #include <QtWebEngineCore/qwebenginedownloadrequest.h> -#include <QtWebEngineCore/qwebenginehttprequest.h> +#include <QtWebEngineCore/qwebenginequotarequest.h> #include <QtCore/qobject.h> #include <QtCore/qurl.h> -#include <QtCore/qvariant.h> -#include <QtGui/qaction.h> +#include <QtGui/qpagelayout.h> +#include <QtGui/qpageranges.h> +#include <QtGui/qtgui-config.h> #include <functional> QT_BEGIN_NAMESPACE +class QAction; class QAuthenticator; class QContextMenuBuilder; +class QRect; +class QVariant; class QWebChannel; class QWebEngineCertificateError; -class QWebEngineClientCertificateSelection; +class QWebEngineDesktopMediaRequest; +class QWebEngineFileSystemAccessRequest; class QWebEngineFindTextResult; class QWebEngineFullScreenRequest; class QWebEngineHistory; +class QWebEngineHttpRequest; class QWebEngineLoadingInfo; class QWebEngineNavigationRequest; class QWebEngineNewWindowRequest; class QWebEnginePagePrivate; class QWebEngineProfile; -class QWebEngineQuotaRequest; class QWebEngineRegisterProtocolHandlerRequest; class QWebEngineScriptCollection; class QWebEngineSettings; class QWebEngineUrlRequestInterceptor; +class QWebEngineWebAuthUxRequest; -class Q_WEBENGINECORE_EXPORT QWebEnginePage : public QObject { +class Q_WEBENGINECORE_EXPORT QWebEnginePage : public QObject +{ Q_OBJECT Q_PROPERTY(QString selectedText READ selectedText) Q_PROPERTY(bool hasSelection READ hasSelection) Q_PROPERTY(QUrl requestedUrl READ requestedUrl) Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) - Q_PROPERTY(QString title READ title) - Q_PROPERTY(QUrl url READ url WRITE setUrl) + Q_PROPERTY(QString title READ title NOTIFY titleChanged) + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(QUrl iconUrl READ iconUrl NOTIFY iconUrlChanged) Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) @@ -153,6 +124,9 @@ public: InsertOrderedList, InsertUnorderedList, + ChangeTextDirectionLTR, + ChangeTextDirectionRTL, + WebActionCount }; Q_ENUM(WebAction) @@ -198,7 +172,9 @@ public: MediaAudioVideoCapture, MouseLock, DesktopVideoCapture, - DesktopAudioVideoCapture + DesktopAudioVideoCapture, + ClipboardReadWrite, + LocalFontsAccess, }; Q_ENUM(Feature) @@ -208,6 +184,7 @@ public: FileSelectOpen, FileSelectOpenMultiple, FileSelectUploadFolder, + FileSelectSave }; Q_ENUM(FileSelectionMode) @@ -246,7 +223,7 @@ public: QWebEngineProfile *profile() const; -#ifndef QT_NO_ACTION +#if QT_CONFIG(action) QAction *action(WebAction action) const; #endif virtual void triggerAction(WebAction action, bool checked = false); @@ -301,10 +278,18 @@ public: bool recentlyAudible() const; qint64 renderProcessPid() const; + void printToPdf(const QString &filePath, + const QPageLayout &layout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF()), + const QPageRanges &ranges = {}); + void printToPdf(const std::function<void(const QByteArray&)> &resultCallback, + const QPageLayout &layout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF()), + const QPageRanges &ranges = {}); + void setInspectedPage(QWebEnginePage *page); QWebEnginePage *inspectedPage() const; void setDevToolsPage(QWebEnginePage *page); QWebEnginePage *devToolsPage() const; + QString devToolsId() const; void setUrlRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor); @@ -326,19 +311,24 @@ Q_SIGNALS: void linkHovered(const QString &url); void selectionChanged(); - void geometryChangeRequested(const QRect& geom); + void geometryChangeRequested(const QRect &geom); void windowCloseRequested(); void featurePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature); void featurePermissionRequestCanceled(const QUrl &securityOrigin, QWebEnginePage::Feature feature); void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); +#if QT_DEPRECATED_SINCE(6, 5) + QT_DEPRECATED_VERSION_X_6_5("Requesting host quota is no longer supported.") void quotaRequested(QWebEngineQuotaRequest quotaRequest); +#endif void registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request); + void fileSystemAccessRequested(QWebEngineFileSystemAccessRequest request); void selectClientCertificate(QWebEngineClientCertificateSelection clientCertSelection); void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator); void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost); void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode); + void desktopMediaRequested(const QWebEngineDesktopMediaRequest &request); void certificateError(const QWebEngineCertificateError &certificateError); void navigationRequested(QWebEngineNavigationRequest &request); void newWindowRequested(QWebEngineNewWindowRequest &request); @@ -355,6 +345,9 @@ Q_SIGNALS: void recentlyAudibleChanged(bool recentlyAudible); void renderProcessPidChanged(qint64 pid); + void pdfPrintingFinished(const QString &filePath, bool success); + void printRequested(); + void visibleChanged(bool visible); void lifecycleStateChanged(LifecycleState state); @@ -365,35 +358,41 @@ Q_SIGNALS: // TODO: fixme / rewrite bindPageToView void _q_aboutToDelete(); + void webAuthUxRequested(QWebEngineWebAuthUxRequest *request); + protected: virtual QWebEnginePage *createWindow(WebWindowType type); - virtual QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes); - virtual void javaScriptAlert(const QUrl &securityOrigin, const QString& msg); - virtual bool javaScriptConfirm(const QUrl &securityOrigin, const QString& msg); - virtual bool javaScriptPrompt(const QUrl &securityOrigin, const QString& msg, const QString& defaultValue, QString* result); - virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID); + virtual QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, + const QStringList &acceptedMimeTypes); + virtual void javaScriptAlert(const QUrl &securityOrigin, const QString &msg); + virtual bool javaScriptConfirm(const QUrl &securityOrigin, const QString &msg); + virtual bool javaScriptPrompt(const QUrl &securityOrigin, const QString &msg, + const QString &defaultValue, QString *result); + virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, + const QString &message, int lineNumber, + const QString &sourceID); virtual bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame); private: Q_DISABLE_COPY(QWebEnginePage) Q_DECLARE_PRIVATE(QWebEnginePage) QScopedPointer<QWebEnginePagePrivate> d_ptr; -#ifndef QT_NO_ACTION +#if QT_CONFIG(action) Q_PRIVATE_SLOT(d_func(), void _q_webActionTriggered(bool checked)) #endif friend class QContextMenuBuilder; friend class QWebEngineView; friend class QWebEngineViewPrivate; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) friend class QWebEngineViewAccessible; -#endif // QT_NO_ACCESSIBILITY +#endif // QT_CONFIG(accessibility) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEnginePage::FindFlags) Q_WEBENGINECORE_EXPORT QDataStream &operator<<(QDataStream &stream, - const QWebEngineHistory &history); + const QWebEngineHistory &history); Q_WEBENGINECORE_EXPORT QDataStream &operator>>(QDataStream &stream, QWebEngineHistory &history); QT_END_NAMESPACE |