Skip to content

Commit

Permalink
[composer] Fix missing undo command for editing legend items, other s…
Browse files Browse the repository at this point in the history
…mall fixes for legend undoing
  • Loading branch information
nyalldawson committed Jun 26, 2014
1 parent 899c2f8 commit 4113f19
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/composer/qgscomposerlegendwidget.cpp
Expand Up @@ -205,7 +205,7 @@ void QgsComposerLegendWidget::on_mWrapCharLineEdit_textChanged( const QString &t
{
if ( mLegend )
{
mLegend->beginCommand( tr( "Item wrapping changed" ), QgsComposerMergeCommand::ComposerLegendText );
mLegend->beginCommand( tr( "Item wrapping changed" ) );
mLegend->setWrapChar( text );
mLegend->adjustBoxSize();
mLegend->update();
Expand Down Expand Up @@ -724,14 +724,14 @@ void QgsComposerLegendWidget::on_mRemoveToolButton_clicked()
return;
}

mLegend->beginCommand( "Legend item removed" );

QItemSelectionModel* selectionModel = mItemTreeView->selectionModel();
if ( !selectionModel )
{
return;
}

mLegend->beginCommand( "Legend item removed" );

QList<QPersistentModelIndex> indexes;
foreach ( const QModelIndex &index, selectionModel->selectedIndexes() )
indexes << index;
Expand Down Expand Up @@ -773,13 +773,14 @@ void QgsComposerLegendWidget::on_mEditPushButton_clicked()
}

QgsComposerLegendItemDialog itemDialog( currentItem );
if ( itemDialog.exec() == QDialog::Accepted )
if ( itemDialog.exec() != QDialog::Accepted )
{
currentItem->setUserText( itemDialog.itemText() );
mLegend->model()->updateItemText( currentItem );
return;
}

mLegend->beginCommand( tr( "Legend item edited" ) );
currentItem->setUserText( itemDialog.itemText() );
mLegend->model()->updateItemText( currentItem );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
Expand Down

0 comments on commit 4113f19

Please sign in to comment.