Clear qt_button_down widget when starting a drag.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Mon, 9 Jul 2012 10:50:00 +0000 (12:50 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 11 Jul 2012 12:52:17 +0000 (14:52 +0200)
Prevent pickMouseReceiver() from using the
widget from which the drag was started.

Task-number: QTBUG-26145
Change-Id: I65d4c295a894193e41c676fb9fd1f7113c2631b5
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
src/gui/kernel/qdnd.cpp
src/gui/kernel/qguiapplication.cpp
src/gui/kernel/qguiapplication_p.h
src/widgets/kernel/qapplication.cpp
src/widgets/kernel/qapplication_p.h

index 8182719..a97583b 100644 (file)
@@ -195,6 +195,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
 
     m_object->d_func()->target = 0;
 
+    QGuiApplicationPrivate::instance()->notifyDragStarted(o);
     const Qt::DropAction result = m_platformDrag->drag(m_object);
     m_object = 0;
     return result;
index fd7e32e..a998642 100644 (file)
@@ -2527,6 +2527,14 @@ void QGuiApplicationPrivate::notifyThemeChanged()
     }
 }
 
+#ifndef QT_NO_DRAGANDDROP
+void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag)
+{
+    Q_UNUSED(drag)
+
+}
+#endif
+
 const QDrawHelperGammaTables *QGuiApplicationPrivate::gammaTables()
 {
     QDrawHelperGammaTables *result = m_gammaTables.load();
index 857dc53..58a82a9 100644 (file)
@@ -62,6 +62,9 @@ class QPlatformIntegration;
 class QPlatformTheme;
 class QPlatformDragQtResponse;
 struct QDrawHelperGammaTables;
+#ifndef QT_NO_DRAGANDDROP
+class QDrag;
+#endif // QT_NO_DRAGANDDROP
 
 class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
 {
@@ -240,8 +243,13 @@ public:
 
 protected:
     virtual void notifyThemeChanged();
+#ifndef QT_NO_DRAGANDDROP
+    virtual void notifyDragStarted(const QDrag *);
+#endif // QT_NO_DRAGANDDROP
 
 private:
+    friend class QDragManager;
+
     void init();
 
     static QGuiApplicationPrivate *self;
index 997a663..6634a2e 100644 (file)
@@ -4503,6 +4503,15 @@ void QApplicationPrivate::notifyThemeChanged()
     initSystemPalette();
 }
 
+#ifndef QT_NO_DRAGANDDROP
+void QApplicationPrivate::notifyDragStarted(const QDrag *drag)
+{
+    // Prevent pickMouseReceiver() from using the widget where the drag was started after a drag operation.
+    QGuiApplicationPrivate::notifyDragStarted(drag);
+    qt_button_down = 0;
+}
+#endif // QT_NO_DRAGANDDROP
+
 #ifndef QT_NO_GESTURES
 QGestureManager* QGestureManager::instance()
 {
index 7b69129..3ce5908 100644 (file)
@@ -195,6 +195,9 @@ public:
 
 protected:
     void notifyThemeChanged();
+#ifndef QT_NO_DRAGANDDROP
+    void notifyDragStarted(const QDrag *);
+#endif // QT_NO_DRAGANDDROP
 
 public:
     static QFont *sys_font;