From 5b86425b762dab1f6b5bc3e0d6776188c8d927af Mon Sep 17 00:00:00 2001 From: Ludovic Fauvet Date: Fri, 24 Sep 2010 00:04:50 +0200 Subject: [PATCH] qt4: attempt to work around a design flaw in the toolbar editor Signed-off-by: Jean-Baptiste Kempf --- modules/gui/qt4/dialogs/toolbar.cpp | 7 +++++++ modules/gui/qt4/dialogs/toolbar.hpp | 1 + 2 files changed, 8 insertions(+) diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp index 17ec24da8f..72cf40776d 100644 --- a/modules/gui/qt4/dialogs/toolbar.cpp +++ b/modules/gui/qt4/dialogs/toolbar.cpp @@ -672,6 +672,11 @@ void DroppingController::dropEvent( QDropEvent *event ) { int i = getParentPosInLayout( event->pos() ); + /* Workaround: do not let the item move to its current + position + 1 as it breaks the widgetList */ + if ( i - 1 == i_dragIndex ) + --i; + QByteArray data = event->mimeData()->data( "vlc/button-bar" ); QDataStream dataStream(&data, QIODevice::ReadOnly); @@ -727,6 +732,8 @@ bool DroppingController::eventFilter( QObject *obj, QEvent *event ) } if( i == -1 ) return true; + i_dragIndex = i; + doubleInt *dI = widgetList.at( i ); int i_type = dI->i_type; diff --git a/modules/gui/qt4/dialogs/toolbar.hpp b/modules/gui/qt4/dialogs/toolbar.hpp index 6a436d806c..52f4241eff 100644 --- a/modules/gui/qt4/dialogs/toolbar.hpp +++ b/modules/gui/qt4/dialogs/toolbar.hpp @@ -112,6 +112,7 @@ private: }; QRubberBand *rubberband; QList widgetList; + int i_dragIndex; int getParentPosInLayout( QPoint point); -- 2.39.2