src/gui/graphicsview/qgraphicsproxywidget.cpp
changeset 30 5dc02b23752f
parent 22 79de32ba3296
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -975,6 +975,7 @@
                 d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
             }
             break;
+#ifndef QT_NO_TOOLTIP
         case QEvent::ToolTipChange:
             // Propagate tooltip change to the proxy.
             if (!d->tooltipChangeMode) {
@@ -983,6 +984,7 @@
                 d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
             }
             break;
+#endif
         default:
             break;
         }
@@ -1024,9 +1026,18 @@
     // Map event position from us to the receiver
     pos = d->mapToReceiver(pos, receiver);
 
+    QPoint globalPos = receiver->mapToGlobal(pos.toPoint());
+    //If the receiver by-pass the proxy its popups
+    //will be top level QWidgets therefore they need
+    //the screen position. mapToGlobal expect the widget to
+    //have proper coordinates in regards of the windowing system
+    //but it's not true because the widget is embedded.
+    if (bypassGraphicsProxyWidget(receiver))
+        globalPos = event->screenPos();
+
     // Send mouse event. ### Doesn't propagate the event.
     QContextMenuEvent contextMenuEvent(QContextMenuEvent::Reason(event->reason()),
-                                       pos.toPoint(), receiver->mapToGlobal(pos.toPoint()), event->modifiers());
+                                       pos.toPoint(), globalPos, event->modifiers());
     QApplication::sendEvent(receiver, &contextMenuEvent);
 
     event->setAccepted(contextMenuEvent.isAccepted());