summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/api/qwebenginecertificateerror.cpp20
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp6
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.h4
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp17
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp3
-rw-r--r--src/webenginewidgets/api/qwebenginescript.cpp2
-rw-r--r--src/webenginewidgets/api/qwebenginescriptcollection.cpp2
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp2
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc19
9 files changed, 48 insertions, 27 deletions
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/webenginewidgets/api/qwebenginecertificateerror.cpp
index a61d98f94..45277e19d 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp
+++ b/src/webenginewidgets/api/qwebenginecertificateerror.cpp
@@ -110,9 +110,9 @@ QWebEngineCertificateError::QWebEngineCertificateError(const QSharedPointer<Cert
d->chain = controller->chain();
}
-QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &other) = default;
+QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &) = default;
-QWebEngineCertificateError& QWebEngineCertificateError::operator=(const QWebEngineCertificateError &other) = default;
+QWebEngineCertificateError& QWebEngineCertificateError::operator=(const QWebEngineCertificateError &) = default;
/*! \internal
*/
@@ -190,6 +190,8 @@ QString QWebEngineCertificateError::errorDescription() const
}
/*!
+ \since 5.14
+
Marks the certificate error for delayed handling.
This function should be called when there is a need to postpone the decision whether to ignore a
@@ -207,6 +209,8 @@ void QWebEngineCertificateError::defer()
}
/*!
+ \since 5.14
+
Returns whether the decision for error handling was delayed and the URL load was halted.
*/
bool QWebEngineCertificateError::deferred() const
@@ -215,6 +219,8 @@ bool QWebEngineCertificateError::deferred() const
}
/*!
+ \since 5.14
+
Ignores the certificate error and continues the loading of the requested URL.
*/
void QWebEngineCertificateError::ignoreCertificateError()
@@ -223,6 +229,8 @@ void QWebEngineCertificateError::ignoreCertificateError()
}
/*!
+ \since 5.14
+
Rejects the certificate and aborts the loading of the requested URL.
*/
void QWebEngineCertificateError::rejectCertificate()
@@ -231,7 +239,9 @@ void QWebEngineCertificateError::rejectCertificate()
}
/*!
- Returns \c true if the error was explicitly rejected or accepted.
+ \since 5.14
+
+ Returns \c true if the error was explicitly rejected or ignored.
*/
bool QWebEngineCertificateError::answered() const
{
@@ -239,7 +249,9 @@ bool QWebEngineCertificateError::answered() const
}
/*!
- Returns the peer's chain of digital certificates
+ \since 5.14
+
+ Returns the peer's chain of digital certificates.
Chain starts with the peer's immediate certificate and ending with the CA's certificate.
*/
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index 7b0cfe074..724249208 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -560,7 +560,7 @@ void QWebEngineDownloadItem::setPath(QString path)
d->downloadDirectory = QStringLiteral("");
d->downloadFileName = path;
} else {
- d->downloadDirectory = QFileInfo(path).filePath();
+ d->downloadDirectory = QFileInfo(path).path();
d->downloadFileName = QFileInfo(path).fileName();
}
}
@@ -588,7 +588,7 @@ QString QWebEngineDownloadItem::downloadDirectory() const
download item's state.
*/
-void QWebEngineDownloadItem::setDownloadDirectory(QString directory)
+void QWebEngineDownloadItem::setDownloadDirectory(const QString &directory)
{
Q_D(QWebEngineDownloadItem);
if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) {
@@ -626,7 +626,7 @@ QString QWebEngineDownloadItem::downloadFileName() const
download item's state.
*/
-void QWebEngineDownloadItem::setDownloadFileName(QString fileName)
+void QWebEngineDownloadItem::setDownloadFileName(const QString &fileName)
{
Q_D(QWebEngineDownloadItem);
if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) {
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h
index 169d80553..27fca6f8a 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.h
@@ -130,9 +130,9 @@ public:
bool isSavePageDownload() const;
QString suggestedFileName() const;
QString downloadDirectory() const;
- void setDownloadDirectory(QString directory);
+ void setDownloadDirectory(const QString &directory);
QString downloadFileName() const;
- void setDownloadFileName(QString fileName);
+ void setDownloadFileName(const QString &fileName);
QWebEnginePage *page() const;
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index b22d47916..db3efa521 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -178,7 +178,6 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
wasShownTimer.setSingleShot(true);
QObject::connect(&wasShownTimer, &QTimer::timeout, [this](){
ensureInitialized();
- adapter->setVisible(true);
});
profile->d_ptr->addWebContentsAdapterClient(this);
@@ -442,7 +441,7 @@ void QWebEnginePagePrivate::didPrintPage(quint64 requestId, QSharedPointer<QByte
printerThread->start();
PrinterWorker *printerWorker = new PrinterWorker(result, currentPrinter);
- QObject::connect(printerWorker, &PrinterWorker::resultReady, q, [=](bool success) {
+ QObject::connect(printerWorker, &PrinterWorker::resultReady, q, [requestId, this](bool success) {
currentPrinter = nullptr;
m_callbacks.invoke(requestId, success);
});
@@ -1720,8 +1719,8 @@ void QWebEnginePagePrivate::allowCertificateError(const QSharedPointer<Certifica
accepted = q->certificateError(error);
if (error.deferred() && !error.answered())
m_certificateErrorControllers.append(controller);
- else if (!error.answered() && error.isOverridable())
- controller->accept(accepted);
+ else if (!error.answered())
+ controller->accept(error.isOverridable() && accepted);
}
void QWebEnginePagePrivate::selectClientCert(const QSharedPointer<ClientCertSelectController> &controller)
@@ -1817,7 +1816,7 @@ void QWebEnginePagePrivate::setToolTip(const QString &toolTipText)
}
// Update tooltip if text was changed.
- QString wrappedTip = QLatin1String("<p style=\"white-space:pre\">")
+ QString wrappedTip = QLatin1String("<p style=\"white-space:pre-wrap\">")
% toolTipText.toHtmlEscaped().left(MaxTooltipLength)
% QLatin1String("</p>");
if (view->toolTip() != wrappedTip)
@@ -2178,7 +2177,7 @@ void QWebEnginePage::runJavaScript(const QString& scriptSource, quint32 worldId,
In addition, a page might also execute scripts
added through QWebEngineProfile::scripts().
- \sa QWebEngineScriptCollection, QWebEngineScript
+ \sa QWebEngineScriptCollection, QWebEngineScript, {Script Injection}
*/
QWebEngineScriptCollection &QWebEnginePage::scripts()
@@ -2544,7 +2543,7 @@ const QWebEngineContextMenuData &QWebEnginePage::contextMenuData() const
\value Discarded
Very low resource usage state where the entire browsing context is discarded.
- \sa lifecycleState, {WebEngine Lifecycle Example}
+ \sa lifecycleState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
/*!
@@ -2566,7 +2565,7 @@ const QWebEngineContextMenuData &QWebEnginePage::contextMenuData() const
These are the only hard limits on the lifecycle state, but see also
\l{recommendedState} for the recommended soft limits.
- \sa recommendedState, {WebEngine Lifecycle Example}
+ \sa recommendedState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
QWebEnginePage::LifecycleState QWebEnginePage::lifecycleState() const
@@ -2592,7 +2591,7 @@ void QWebEnginePage::setLifecycleState(LifecycleState state)
playback or loss of HTML form input. Setting the lifecycle state to a higher
resource state is however completely safe.
- \sa lifecycleState
+ \sa lifecycleState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
QWebEnginePage::LifecycleState QWebEnginePage::recommendedState() const
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 4a77eb8cf..09f5ce2fd 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -661,7 +661,8 @@ bool QWebEngineProfile::visitedLinksContainsUrl(const QUrl &url) const
Returns the collection of scripts that are injected into all pages that share
this profile.
- \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts()
+ \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts(),
+ {Script Injection}
*/
QWebEngineScriptCollection *QWebEngineProfile::scripts() const
{
diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/webenginewidgets/api/qwebenginescript.cpp
index d1e996b3a..af6b9aa8d 100644
--- a/src/webenginewidgets/api/qwebenginescript.cpp
+++ b/src/webenginewidgets/api/qwebenginescript.cpp
@@ -67,6 +67,8 @@ using QtWebEngineCore::UserScript;
Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access
the collection of scripts associated with a single page or a
number of pages sharing the same profile.
+
+ \sa {Script Injection}
*/
/*!
\enum QWebEngineScript::InjectionPoint
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.cpp b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
index 5ef0ffd44..8cbeeb804 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.cpp
+++ b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
@@ -55,6 +55,8 @@ using QtWebEngineCore::UserScript;
Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access
the collection of scripts associated with a single page or a
number of pages sharing the same profile.
+
+ \sa {Script Injection}
*/
/*!
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index ac979e766..de81448a9 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -61,6 +61,7 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage
Q_Q(QWebEngineView);
if (oldPage) {
+ oldPage->setVisible(false);
oldPage->disconnect(q);
}
@@ -74,6 +75,7 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage
QObject::connect(newPage, &QWebEnginePage::loadFinished, q, &QWebEngineView::loadFinished);
QObject::connect(newPage, &QWebEnginePage::selectionChanged, q, &QWebEngineView::selectionChanged);
QObject::connect(newPage, &QWebEnginePage::renderProcessTerminated, q, &QWebEngineView::renderProcessTerminated);
+ newPage->setVisible(q->isVisible());
}
auto oldUrl = oldPage ? oldPage->url() : QUrl();
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 699d7f181..7701b9b3d 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -767,10 +767,15 @@
\fn void QWebEnginePage::runJavaScript(const QString &scriptSource, const QWebEngineCallback<const QVariant &> &resultCallback)
\since 5.7
- Runs the JavaScript code contained in \a scriptSource in the world specified by \a worldId.
- The world ID values are the same as provided by QWebEngineScript::ScriptWorldId, and between \c 0
- and \c 256. Using the \e runJavaScript() versions without the world ID is the same as running the
- script in the \c MainWorld.
+ Runs the JavaScript code contained in \a scriptSource without checking
+ whether the DOM of the page has been constructed. If you need more
+ control over how the script is run, consider using \l scripts() instead.
+
+ To avoid conflicts with other scripts executed on the page, the world in
+ which the script is run is specified by \a worldId. The world ID values are
+ the same as provided by QWebEngineScript::ScriptWorldId, and between \c 0
+ and \c 256. If you leave out the \c world ID, the script is run in the
+ \c MainWorld.
When the script has been executed, \a resultCallback is called with the result of the last
executed statement. \c resultCallback can be any of a function pointer, a functor or a lambda,
@@ -780,7 +785,7 @@
page.runJavaScript("document.title", [](const QVariant &v) { qDebug() << v.toString(); });
\endcode
- Only "plain data" can be returned from JavaScript as the result value.
+ Only plain data can be returned from JavaScript as the result value.
Supported data types include all of the JSON data types as well as, for
example, \c{Date} and \c{ArrayBuffer}. Unsupported data types include, for
example, \c{Function} and \c{Promise}.
@@ -792,9 +797,7 @@
during page destruction. When QWebEnginePage is deleted, the callback is triggered with an invalid
value and it is not safe to use the corresponding QWebEnginePage or QWebEngineView instance inside it.
- See scripts() for an alternative API to inject scripts.
-
- \sa QWebEngineScript::ScriptWorldId
+ \sa scripts(), QWebEngineScript::ScriptWorldId, {Script Injection}
*/
/*!