[vlc-devel] commit: Qt: customize dialogs, fix a misswrite with the last item of a toolbar. (Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Jul 20 00:57:16 CEST 2009


vlc | branch: 1.0-bugfix | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jul 20 00:55:53 2009 +0200| [10b5e70161e5f7304239f8e03ff61469fae01c5d] | committer: Jean-Baptiste Kempf 

Qt: customize dialogs, fix a misswrite with the last item of a toolbar.
(cherry picked from commit 52b528be1b922dfb74add64729e1596e3c4aec8f)

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

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

 modules/gui/qt4/dialogs/toolbar.cpp |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp
index 2ca4f79..b2f62b8 100644
--- a/modules/gui/qt4/dialogs/toolbar.cpp
+++ b/modules/gui/qt4/dialogs/toolbar.cpp
@@ -498,6 +498,10 @@ void DroppingController::createAndAddWidget( QBoxLayout *controlLayout,
                                              buttonType_e i_type,
                                              int i_option )
 {
+    doubleInt *value = new doubleInt;
+    value->i_type = i_type;
+    value->i_option = i_option;
+
     /* Special case for SPACERS, who aren't QWidgets */
     if( i_type == WIDGET_SPACER || i_type == WIDGET_SPACER_EXTEND )
     {
@@ -567,10 +571,6 @@ void DroppingController::createAndAddWidget( QBoxLayout *controlLayout,
     /* QList and QBoxLayout don't act the same with insert() */
     if( i_index < 0 ) i_index = controlLayout->count() - 1;
 
-    /* Insert in the value listing */
-    doubleInt *value = new doubleInt;
-    value->i_type = i_type;
-    value->i_option = i_option;
     widgetList.insert( i_index, value );
 }
 
@@ -739,12 +739,14 @@ bool DroppingController::eventFilter( QObject *obj, QEvent *event )
             QDrag *drag = new QDrag( widg );
             drag->setMimeData( mimeData );
 
+            /* Remove before the drag to not mess DropEvent,
+               that will createAndAddWidget */
+            widgetList.removeAt( i );
+
             /* Start the effective drag */
             drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::MoveAction);
-
-            widgetList.removeAt( i );
-            controlLayout->removeWidget( widg );
             widg->hide();
+            controlLayout->removeWidget( widg );
             b_draging = false;
             }
             return true;




More information about the vlc-devel mailing list