From kde-commits Mon Sep 30 17:24:07 2013 From: Sergio Martins Date: Mon, 30 Sep 2013 17:24:07 +0000 To: kde-commits Subject: [kdepim/KDE/4.11] calendarviews/agenda: Fix DnD when dropping onto another item instead of the view. Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=138056185810227 Git commit 1da97ef37c2d7dc9dbb94fdbbbb0718705df1511 by Sergio Martins. Committed on 30/09/2013 at 17:20. Pushed by smartins into branch 'KDE/4.11'. Fix DnD when dropping onto another item instead of the view. The drop event's pos() is relative to the drop target but the code was expecting view coordinates. map to view coordinates. M +8 -2 calendarviews/agenda/agenda.cpp http://commits.kde.org/kdepim/1da97ef37c2d7dc9dbb94fdbbbb0718705df1511 diff --git a/calendarviews/agenda/agenda.cpp b/calendarviews/agenda/agenda.= cpp index f278829..aa18eef 100644 --- a/calendarviews/agenda/agenda.cpp +++ b/calendarviews/agenda/agenda.cpp @@ -555,7 +555,7 @@ bool Agenda::eventFilter ( QObject *object, QEvent *eve= nt ) } } = -bool Agenda::eventFilter_drag( QObject *, QDropEvent *de ) +bool Agenda::eventFilter_drag( QObject *obj, QDropEvent *de ) { #ifndef QT_NO_DRAGANDDROP const QMimeData *md =3D de->mimeData(); @@ -591,7 +591,13 @@ bool Agenda::eventFilter_drag( QObject *, QDropEvent *= de ) = de->setDropAction( Qt::MoveAction ); = - const QPoint gridPosition =3D contentsToGrid( de->pos() ); + QWidget *dropTarget =3D qobject_cast( obj ); + QPoint dropPosition =3D de->pos(); + if ( dropTarget && dropTarget !=3D this ) { + dropPosition =3D dropTarget->mapTo( this, dropPosition ); + } + + const QPoint gridPosition =3D contentsToGrid( dropPosition ); if ( !incidenceUrls.isEmpty() ) { emit droppedIncidences( incidenceUrls, gridPosition, d->mAllDayMode = ); } else {