summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativemousearea.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2011-05-19 12:15:26 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2011-05-19 12:15:26 (GMT)
commit37c4cd4801106112b638ed9d2164b87bbc0a0d1e (patch)
tree3dcc9e1b9908328d1355f5746fd77de7030b547f /src/declarative/graphicsitems/qdeclarativemousearea.cpp
parentb6a6953d21a95c402e8a5010c1ea5131509eeea3 (diff)
parent35b5f15c3fe5c2f1f0d046d09b9d95dee3bb91b5 (diff)
downloadQt-37c4cd4801106112b638ed9d2164b87bbc0a0d1e.zip
Qt-37c4cd4801106112b638ed9d2164b87bbc0a0d1e.tar.gz
Qt-37c4cd4801106112b638ed9d2164b87bbc0a0d1e.tar.bz2
Merge branch '4.8-upstream'
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativemousearea.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index d4e7f7b..6633256 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -660,6 +660,32 @@ void QDeclarativeMouseArea::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
setHovered(false);
}
+#ifndef QT_NO_CONTEXTMENU
+void QDeclarativeMouseArea::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
+{
+ bool acceptsContextMenuButton;
+#if defined(Q_OS_SYMBIAN)
+ // In Symbian a Long Tap on the screen will trigger. See QSymbianControl::HandleLongTapEventL().
+ acceptsContextMenuButton = acceptedButtons() & Qt::LeftButton;
+#elif defined(Q_WS_WINCE)
+ // ### WinCE can trigger context menu event with a gesture in the left button or a
+ // click with the right button. Since we have no way here to differentiate them when
+ // event happens, accepting either of the them will block the event.
+ acceptsContextMenuButton = acceptedButtons() & (Qt::LeftButton | Qt::RightButton);
+#else
+ acceptsContextMenuButton = acceptedButtons() & Qt::RightButton;
+#endif
+
+ if (isEnabled() && event->reason() == QGraphicsSceneContextMenuEvent::Mouse
+ && acceptsContextMenuButton) {
+ // Do not let the context menu event propagate to items behind.
+ return;
+ }
+
+ QDeclarativeItem::contextMenuEvent(event);
+}
+#endif // QT_NO_CONTEXTMENU
+
bool QDeclarativeMouseArea::sceneEvent(QEvent *event)
{
bool rv = QDeclarativeItem::sceneEvent(event);