[vlc-commits] commit: qt4: attempt to work around a design flaw in the toolbar editor ( Ludovic Fauvet )

git at videolan.org git at videolan.org
Mon Sep 27 16:44:49 CEST 2010


vlc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Fri Sep 24 00:04:50 2010 +0200| [5b86425b762dab1f6b5bc3e0d6776188c8d927af] | committer: Jean-Baptiste Kempf 

qt4: attempt to work around a design flaw in the toolbar editor

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b86425b762dab1f6b5bc3e0d6776188c8d927af
---

 modules/gui/qt4/dialogs/toolbar.cpp |    7 +++++++
 modules/gui/qt4/dialogs/toolbar.hpp |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp
index 17ec24d..72cf407 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 6a436d8..52f4241 100644
--- a/modules/gui/qt4/dialogs/toolbar.hpp
+++ b/modules/gui/qt4/dialogs/toolbar.hpp
@@ -112,6 +112,7 @@ private:
     };
     QRubberBand *rubberband;
     QList <doubleInt *> widgetList;
+    int i_dragIndex;
 
     int getParentPosInLayout( QPoint point);
 



More information about the vlc-commits mailing list