summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorOleg Yadrov <oleg.yadrov@qt.io>2017-01-16 15:39:32 -0800
committerOleg Yadrov <oleg.yadrov@qt.io>2017-01-20 17:43:52 +0000
commita41677d04c3835eb12a30cf546c0b0804592325d (patch)
tree63bb923f69b3f75c6a86e74c288e7c7b3c363759 /src/widgets/kernel
parent5060740fa980fdd5d2828b3b7e8956386266a7eb (diff)
QQuickWidget: fix drag and drop
QQuickWidget did not receive mouse release events after drag and drop because the logic was so: 1) QWidgetWindow::handleMouseEvent() was called on press and qt_button_down was set to the corresponding QQuickWidget; 2) After drag started, qt_button_down was set to 0 in QApplicationPrivate::notifyDragStarted(); 3) On mouse release QWidgetWindow::handleMouseEvent() was called again, but because qt_button_down was 0 QApplicationPrivate::pickMouseReceiver() returned 0 and as a result QWidgetWindow ignored the event and did not propagate it to QQuickWidget for further processing. The step 2 is a widgets-specific fix for QTBUG-26145 that does not work for QQuickWidget (QtQuick has its own focus system). Note that because Widgets and QtQuick do not share the sources, there is no possibility to cast the pointer to check whether qt_button_down is a QQuickWidget or some other QWidget-derived class object, so we have to use QObject::inherits() method to check that. Task-number: QTBUG-56713 Change-Id: I599b843e903c64329e6178752e0dc49f674bb890 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 128b5dc2b8..5908d3036b 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -4501,9 +4501,13 @@ void QApplicationPrivate::notifyThemeChanged()
#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;
+ // QTBUG-26145
+ // Prevent pickMouseReceiver() from using the widget where the drag was started after a drag operation...
+ // QTBUG-56713
+ // ...only if qt_button_down is not a QQuickWidget
+ if (qt_button_down && !qt_button_down->inherits("QQuickWidget"))
+ qt_button_down = nullptr;
}
#endif // QT_NO_DRAGANDDROP