]> git.sesse.net Git - vlc/commitdiff
qt4: attempt to work around a design flaw in the toolbar editor
authorLudovic Fauvet <etix@l0cal.com>
Thu, 23 Sep 2010 22:04:50 +0000 (00:04 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 27 Sep 2010 09:19:05 +0000 (11:19 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/dialogs/toolbar.cpp
modules/gui/qt4/dialogs/toolbar.hpp

index 17ec24da8fe5a1d3c3ee1e16a7f694001454afd9..72cf40776d95eb5474e25412a1159e55be9aacc1 100644 (file)
@@ -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;
index 6a436d806c2d60c9f39f38a21bdfef2110f835cf..52f4241eff32bd2bf61935fd647299d3f4b9908d 100644 (file)
@@ -112,6 +112,7 @@ private:
     };
     QRubberBand *rubberband;
     QList <doubleInt *> widgetList;
+    int i_dragIndex;
 
     int getParentPosInLayout( QPoint point);