summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-08 10:12:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-08 10:47:57 +0100
commit233258f132134caaa3c4acf924b47d7e548865e7 (patch)
tree2afbcb2923f13b03fbb1dc15c1c5b3622842ef1e /src/webenginewidgets
parent6666e23ed6252c3ef53c5f17d4f28bfe63736e33 (diff)
parent9ef3a8263098c6a32db8b824aabf85587d1f1140 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: .qmake.conf src/core/api/qwebengineurlrequestjob.cpp src/core/browser_context_adapter.cpp src/core/renderer/user_resource_controller.cpp src/core/web_engine_context.cpp src/webenginewidgets/api/qwebenginepage.cpp Change-Id: I5278e5e22e1776d42975fc94d70ff8ca4f81fb9a
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp24
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp9
-rw-r--r--src/webenginewidgets/api/qwebengineprofile_p.h2
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp15
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc5
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc5
6 files changed, 46 insertions, 14 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 976f72fa4..438e3ea24 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -138,7 +138,8 @@ static bool printPdfDataOnPrinter(const QByteArray& data, QPrinter& printer)
QPainter painter;
if (!painter.begin(&printer)) {
- qWarning("Failure to print on printer %ls: Could not open printer for painting.", qUtf16Printable(printer.printerName()));
+ qWarning("Failure to print on printer %ls: Could not open printer for painting.",
+ qUtf16Printable(printer.printerName()));
return false;
}
@@ -1610,12 +1611,21 @@ bool QWebEnginePagePrivate::isEnabled() const
void QWebEnginePagePrivate::setToolTip(const QString &toolTipText)
{
- if (view) {
- QString wrappedTip;
- if (!toolTipText.isEmpty())
- wrappedTip = QLatin1String("<p>") % toolTipText.toHtmlEscaped().left(MaxTooltipLength) % QLatin1String("</p>");
- view->setToolTip(wrappedTip);
+ if (!view)
+ return;
+
+ // Hide tooltip if shown.
+ if (toolTipText.isEmpty()) {
+ if (!view->toolTip().isEmpty())
+ view->setToolTip(QString());
+
+ return;
}
+
+ // Update tooltip if text was changed.
+ QString wrappedTip = QLatin1String("<p>") % toolTipText.toHtmlEscaped().left(MaxTooltipLength) % QLatin1String("</p>");
+ if (view->toolTip() != wrappedTip)
+ view->setToolTip(wrappedTip);
}
QMenu *QWebEnginePage::createStandardContextMenu()
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index c4de46b67..5a6c0e18a 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -155,11 +155,18 @@ QWebEngineBrowserContext::QWebEngineBrowserContext(QSharedPointer<QtWebEngineCor
QWebEngineBrowserContext::~QWebEngineBrowserContext()
{
+ if (m_profile)
+ shutdown();
+}
+
+void QWebEngineBrowserContext::shutdown()
+{
Q_ASSERT(m_profile);
// In the case the user sets this profile as the parent of the interceptor
// it can be deleted before the browser-context still referencing it is.
browserContextRef->setRequestInterceptor(nullptr);
browserContextRef->removeClient(m_profile);
+ m_profile = 0;
}
QWebEngineProfilePrivate::QWebEngineProfilePrivate(QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext)
@@ -181,6 +188,8 @@ QWebEngineProfilePrivate::~QWebEngineProfilePrivate()
}
m_ongoingDownloads.clear();
+ if (m_browserContext)
+ m_browserContext->shutdown();
}
QSharedPointer<QtWebEngineCore::BrowserContextAdapter> QWebEngineProfilePrivate::browserContext() const
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index 7f02307d3..07aad9176 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -76,6 +76,8 @@ public:
QWebEngineBrowserContext(QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext, QWebEngineProfilePrivate *profile);
~QWebEngineBrowserContext();
+ void shutdown();
+
QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextRef;
private:
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index 9b3f62217..7ea451fc5 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -50,8 +50,9 @@
#include <QAction>
#include <QMenu>
#include <QContextMenuEvent>
-#include <QStackedLayout>
#include <QPageLayout>
+#include <QStackedLayout>
+#include <QToolTip>
QT_BEGIN_NAMESPACE
@@ -327,6 +328,18 @@ bool QWebEngineView::event(QEvent *ev)
ev->accept();
return true;
}
+
+ // Override QWidget's default ToolTip handler since it doesn't hide tooltip on empty text.
+ if (ev->type() == QEvent::ToolTip) {
+ if (!toolTip().isEmpty())
+ QToolTip::showText(static_cast<QHelpEvent *>(ev)->globalPos(), toolTip(), this, QRect(), toolTipDuration());
+ else
+ QToolTip::hideText();
+
+ ev->accept();
+ return true;
+ }
+
return QWidget::event(ev);
}
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 4cad5a063..23b280b6d 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -686,9 +686,8 @@
/*!
\fn void QWebEnginePage::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
- Sets the content of this page to \a data. If the \a mimeType argument
- is empty, it is currently assumed that the content is HTML but in future versions we may introduce
- auto-detection.
+ Sets the content of the web page to \a data. If the \a mimeType argument
+ is empty, it is assumed that the content is \c{text/plain,charset=US-ASCII}.
External objects referenced in the content are located relative to \a baseUrl.
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 27ee96c5e..18d139c00 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -152,9 +152,8 @@
/*!
\fn void QWebEngineView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
- Sets the content of the web view to the specified content \a data. If the \a mimeType argument
- is empty, it is currently assumed that the content is HTML but in future versions we may
- introduce auto-detection.
+ Sets the content of the web view to \a data. If the \a mimeType argument
+ is empty, it is assumed that the content is \c{text/plain,charset=US-ASCII}.
External objects referenced in the content are located relative to \a baseUrl.