]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/toolbar.cpp
qt4: attempt to work around a design flaw in the toolbar editor
[vlc] / modules / gui / qt4 / dialogs / toolbar.cpp
index 8feaa7ac5e813c30773faabadf3153e65a4ae137..72cf40776d95eb5474e25412a1159e55be9aacc1 100644 (file)
 #include <QLabel>
 #include <QComboBox>
 #include <QListWidget>
+#include <QSpinBox>
 
 #include <QDragEnterEvent>
 #include <QDialogButtonBox>
 #include <QInputDialog>
 
+#include <assert.h>
+
 ToolbarEditDialog::ToolbarEditDialog( QWidget *_w, intf_thread_t *_p_intf)
                   : QVLCDialog( _w,  _p_intf )
 {
@@ -669,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);
 
@@ -724,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;