From 02a593dc236ddf6b316a1019d0da935058c107c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 6 Aug 2022 17:40:17 +0200 Subject: [PATCH] DnD now takes the proxy control into account. [GB.QT4] * BUG: Setting the Drop property now acts on the proxy, and the DnD events are handled by the proxy first. [GB.QT5] * BUG: Setting the Drop property now acts on the proxy, and the DnD events are handled by the proxy first. --- gb.qt4/src/CClipboard.cpp | 11 -------- gb.qt4/src/CWidget.cpp | 57 +++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/gb.qt4/src/CClipboard.cpp b/gb.qt4/src/CClipboard.cpp index 70a31436e..57bbcb682 100644 --- a/gb.qt4/src/CClipboard.cpp +++ b/gb.qt4/src/CClipboard.cpp @@ -609,18 +609,7 @@ void CDRAG_drag_leave(CWIDGET *control) CDRAG_hide_frame(control); - //while (EXT(control) && EXT(control)->proxy) - // control = (CWIDGET *)(EXT(control)->proxy); - -__DRAG_LEAVE_TRY_PROXY: - GB.Raise(control, EVENT_DragLeave, 0); - - if (EXT(control) && EXT(control)->proxy) - { - control = (CWIDGET *)(EXT(control)->proxy); - goto __DRAG_LEAVE_TRY_PROXY; - } } diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index 1a9ffb223..fd0057ce7 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -1828,6 +1828,8 @@ END_METHOD BEGIN_PROPERTY(Control_Drop) + HANDLE_PROXY(_object); + if (READ_PROPERTY) GB.ReturnBoolean(THIS->flag.drop); else @@ -3159,12 +3161,20 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) { if (!control->flag.drop) goto __NEXT; - - if (CDRAG_drag_enter((QWidget *)widget, control, (QDropEvent *)event)) + + for(;;) { - if (!((QDropEvent *)event)->isAccepted()) - CDRAG_hide_frame(control); - return true; + if (CDRAG_drag_enter((QWidget *)widget, control, (QDropEvent *)event)) + { + if (!((QDropEvent *)event)->isAccepted()) + CDRAG_hide_frame(control); + return true; + } + + if (!EXT(control) || !EXT(control)->proxy_for) + break; + + control = (CWIDGET *)(EXT(control)->proxy_for); } goto __NEXT; @@ -3187,13 +3197,10 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) } } - if (EXT(control) && EXT(control)->proxy) - { - control = (CWIDGET *)(EXT(control)->proxy); - continue; - } - else + if (!EXT(control) || !EXT(control)->proxy_for) break; + + control = (CWIDGET *)(EXT(control)->proxy_for); } if (GB.CanRaise(control, EVENT_Drop)) @@ -3206,8 +3213,16 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) { if (!control->flag.drop) goto __NEXT; - - CDRAG_drag_leave(control); + + for(;;) + { + CDRAG_drag_leave(control); + + if (!EXT(control) || !EXT(control)->proxy_for) + break; + + control = (CWIDGET *)(EXT(control)->proxy_for); + } goto __NEXT; } @@ -3216,10 +3231,18 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) if (!control->flag.drop) goto __NEXT; - //if (!CWIDGET_test_flag(control, WF_NO_DRAG)) - CDRAG_drag_leave(control); - if (CDRAG_drag_drop((QWidget *)widget, control, (QDropEvent *)event)) - return true; + for(;;) + { + CDRAG_drag_leave(control); + if (CDRAG_drag_drop((QWidget *)widget, control, (QDropEvent *)event)) + return true; + + if (!EXT(control) || !EXT(control)->proxy_for) + break; + + control = (CWIDGET *)(EXT(control)->proxy_for); + } + goto __NEXT; }