Skip to content
Permalink
Browse files
[composer] Fix missing undo command for editing legend items, other s…
…mall fixes for legend undoing
  • Loading branch information
nyalldawson committed Jun 26, 2014
1 parent 899c2f8 commit 4113f190ead976d629ad1ec9b0116f5aab7d5b2a
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/app/composer/qgscomposerlegendwidget.cpp
@@ -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();
@@ -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;
@@ -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();

0 comments on commit 4113f19

Please sign in to comment.