summaryrefslogtreecommitdiffstats
path: root/src/webengine
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-30 08:17:04 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-11-30 08:17:04 +0000
commit71e02bc92c8f93f1063f79507b2250a229db6380 (patch)
tree491ff43dfe9878069548d37e29cc9d713fe1643f /src/webengine
parent05574185dab53476294cf62f2067a4147aa0b6eb (diff)
parent8a164aa2cd83d728ce620c2b7199ebc6222b55cb (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp35
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp7
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h1
-rw-r--r--src/webengine/ui_delegates_manager.cpp33
-rw-r--r--src/webengine/webengine.pro6
5 files changed, 42 insertions, 40 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index e11147760..0636d8471 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -95,27 +95,6 @@
QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
-QQuickWebEngineView::WebAction editorActionForKeyEvent(QKeyEvent* event)
-{
- static struct {
- QKeySequence::StandardKey standardKey;
- QQuickWebEngineView::WebAction action;
- } editorActions[] = {
- { QKeySequence::Cut, QQuickWebEngineView::Cut },
- { QKeySequence::Copy, QQuickWebEngineView::Copy },
- { QKeySequence::Paste, QQuickWebEngineView::Paste },
- { QKeySequence::Undo, QQuickWebEngineView::Undo },
- { QKeySequence::Redo, QQuickWebEngineView::Redo },
- { QKeySequence::SelectAll, QQuickWebEngineView::SelectAll },
- { QKeySequence::UnknownKey, QQuickWebEngineView::NoWebAction }
- };
- for (int i = 0; editorActions[i].standardKey != QKeySequence::UnknownKey; ++i)
- if (event == editorActions[i].standardKey)
- return editorActions[i].action;
-
- return QQuickWebEngineView::NoWebAction;
-}
-
#ifndef QT_NO_ACCESSIBILITY
static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *object)
{
@@ -360,7 +339,7 @@ void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const Q
Q_EMIT q->navigationRequested(&navigationRequest);
navigationRequestAction = navigationRequest.action();
- if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter)
+ if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter && adapter->isFindTextInProgress())
adapter->stopFinding();
}
@@ -579,18 +558,6 @@ void QQuickWebEngineViewPrivate::focusContainer()
void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event)
{
Q_Q(QQuickWebEngineView);
-#ifdef Q_OS_OSX
- if (event->type() == QEvent::KeyPress) {
- QQuickWebEngineView::WebAction action = editorActionForKeyEvent(event);
- if (action != QQuickWebEngineView::NoWebAction) {
- // Try triggering a registered short-cut
- if (QGuiApplicationPrivate::instance()->shortcutMap.tryShortcut(event))
- return;
- q->triggerWebAction(action);
- return;
- }
- }
-#endif
if (q->parentItem())
QCoreApplication::sendEvent(q->parentItem(), event);
}
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index cde742c39..0a31811d9 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -225,7 +225,7 @@ void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVis
bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride)
- return m_client->handleShortcutOverrideEvent(static_cast<QKeyEvent *>(event));
+ return m_client->forwardEvent(event);
#ifndef QT_NO_GESTURES
if (event->type() == QEvent::NativeGesture)
@@ -316,6 +316,11 @@ void RenderWidgetHostViewQtDelegateQuick::hoverMoveEvent(QHoverEvent *event)
m_client->forwardEvent(event);
}
+void RenderWidgetHostViewQtDelegateQuick::hoverLeaveEvent(QHoverEvent *event)
+{
+ m_client->forwardEvent(event);
+}
+
QVariant RenderWidgetHostViewQtDelegateQuick::inputMethodQuery(Qt::InputMethodQuery query) const
{
return m_client->inputMethodQuery(query);
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
index cbcb58c11..a5101d070 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -90,6 +90,7 @@ protected:
void wheelEvent(QWheelEvent *event) override;
void touchEvent(QTouchEvent *event) override;
void hoverMoveEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
void inputMethodEvent(QInputMethodEvent *event) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 43e6e8817..fb23f5db7 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -257,7 +257,7 @@ QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title,
if (!title.isEmpty())
QQmlProperty(menu, QStringLiteral("title")).write(title);
if (!pos.isNull())
- QQmlProperty(menu, QStringLiteral("pos")).write(pos);
+ menu->setProperty("pos", pos);
menu->setParent(parentMenu);
@@ -496,9 +496,38 @@ void UIDelegatesManager::showFilePicker(QSharedPointer<FilePickerController> con
QMetaObject::invokeMethod(filePicker, "open");
}
+class TemporaryCursorMove
+{
+public:
+ TemporaryCursorMove(const QQuickItem *item, const QPoint &pos)
+ {
+ if (pos.isNull() || !item->contains(pos))
+ return;
+ const QPoint oldPos = QCursor::pos();
+ const QPoint globalPos = item->mapToGlobal(QPointF(pos)).toPoint();
+ if (oldPos == globalPos)
+ return;
+ m_oldCursorPos = oldPos;
+ QCursor::setPos(globalPos);
+ }
+
+ ~TemporaryCursorMove()
+ {
+ if (!m_oldCursorPos.isNull())
+ QCursor::setPos(m_oldCursorPos);
+ }
+
+private:
+ QPoint m_oldCursorPos;
+};
+
void UIDelegatesManager::showMenu(QObject *menu)
{
- QMetaObject::invokeMethod(menu, "popup");
+ // QtQuick.Controls.Menu.popup() always shows the menu under the mouse cursor, i.e. the menu's
+ // position we set above is ignored. Work around the problem by moving the mouse cursor
+ // temporarily to the right position.
+ TemporaryCursorMove tcm(m_view, menu->property("pos").toPoint());
+ QMetaObject::invokeMethod(menu, "popup");
}
void UIDelegatesManager::showMessageBubble(const QRect &anchor, const QString &mainText, const QString &subText)
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index 24fa2d9d8..58e1263a7 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -58,7 +58,7 @@ HEADERS = \
render_widget_host_view_qt_delegate_quickwindow.h \
ui_delegates_manager.h
-qtConfig(testsupport) {
+qtConfig(webengine-testsupport) {
QT += testlib
SOURCES += api/qquickwebenginetestsupport.cpp
@@ -67,11 +67,11 @@ qtConfig(testsupport) {
DEFINES += ENABLE_QML_TESTSUPPORT_API
}
-qtConfig(spellchecker) {
+qtConfig(webengine-spellchecker) {
DEFINES += ENABLE_SPELLCHECK
}
-qtConfig(printing-and-pdf) {
+qtConfig(webengine-printing-and-pdf) {
DEFINES += ENABLE_PDF
}