Commit 52b528be authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: customize dialogs, fix a misswrite with the last item of a toolbar.

parent e5454831
...@@ -498,6 +498,10 @@ void DroppingController::createAndAddWidget( QBoxLayout *controlLayout, ...@@ -498,6 +498,10 @@ void DroppingController::createAndAddWidget( QBoxLayout *controlLayout,
buttonType_e i_type, buttonType_e i_type,
int i_option ) 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 */ /* Special case for SPACERS, who aren't QWidgets */
if( i_type == WIDGET_SPACER || i_type == WIDGET_SPACER_EXTEND ) if( i_type == WIDGET_SPACER || i_type == WIDGET_SPACER_EXTEND )
{ {
...@@ -567,10 +571,6 @@ void DroppingController::createAndAddWidget( QBoxLayout *controlLayout, ...@@ -567,10 +571,6 @@ void DroppingController::createAndAddWidget( QBoxLayout *controlLayout,
/* QList and QBoxLayout don't act the same with insert() */ /* QList and QBoxLayout don't act the same with insert() */
if( i_index < 0 ) i_index = controlLayout->count() - 1; 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 ); widgetList.insert( i_index, value );
} }
...@@ -739,12 +739,14 @@ bool DroppingController::eventFilter( QObject *obj, QEvent *event ) ...@@ -739,12 +739,14 @@ bool DroppingController::eventFilter( QObject *obj, QEvent *event )
QDrag *drag = new QDrag( widg ); QDrag *drag = new QDrag( widg );
drag->setMimeData( mimeData ); drag->setMimeData( mimeData );
/* Remove before the drag to not mess DropEvent,
that will createAndAddWidget */
widgetList.removeAt( i );
/* Start the effective drag */ /* Start the effective drag */
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::MoveAction); drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::MoveAction);
widgetList.removeAt( i );
controlLayout->removeWidget( widg );
widg->hide(); widg->hide();
controlLayout->removeWidget( widg );
b_draging = false; b_draging = false;
} }
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment