summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2016-05-26 12:56:17 +0200
committerKai Koehne <kai.koehne@qt.io>2016-05-30 15:21:38 +0000
commit7b2798827326fb251a6ebf6bb3604dcf30b21c7d (patch)
tree8dd60502e757a2f198f3b1ef3f6fb2a1dc24d5a5
parent880824649aa617a715b6d9a31fd1dba18df75a7b (diff)
Disable qtquickcontrols context menu on eglfs
Qt Quick Controls 1 always creates "native" windows for popups, however it does not check if the platform can support creating "native" windows. As a workaround disable context menu until Qt Quick Controls 2 are in place. Task-number: QTBUG-53467 Change-Id: Iea32e19f256f3d7e81a61e23f7da64dfc7ec660d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/webengine/api/qquickwebengineview.cpp10
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 6396e1151..f0458b869 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -115,6 +115,8 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, m_dpiScale(1.0)
, m_backgroundColor(Qt::white)
, m_defaultZoomFactor(1.0)
+ // QTBUG-53467
+ , m_menuEnabled(true)
{
// The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected
// is the (possibly quantized) ratio of device dpi to 160 dpi.
@@ -132,6 +134,8 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
// 1x, 2x, 3x etc assets that fit an integral number of pixels.
setDevicePixelRatio(qMax(1, qRound(webPixelRatio)));
}
+ if (platform == QLatin1Literal("eglfs"))
+ m_menuEnabled = false;
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installFactory(&webAccessibleFactory);
#endif // QT_NO_ACCESSIBILITY
@@ -182,6 +186,12 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
{
Q_Q(QQuickWebEngineView);
+ if (!m_menuEnabled) {
+ qWarning("You are trying to open context menu on eglfs backend, which is not currently supported\n"
+ "See QTBUG-53467.");
+ return false;
+ }
+
// Assign the WebEngineView as the parent of the menu, so mouse events are properly propagated
// on OSX.
QObject *menu = ui()->addMenu(q, QString(), data.pos);
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 831f70afd..c01603cff 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -215,6 +215,8 @@ private:
qreal m_dpiScale;
QColor m_backgroundColor;
qreal m_defaultZoomFactor;
+ // QTBUG-53467
+ bool m_menuEnabled;
};
#ifndef QT_NO_ACCESSIBILITY