Skip to content

Commit 1dc75dd

Browse files
committed
Fix removing composer legend items. Fix #7874 Fix #7464
1 parent 34ef14a commit 1dc75dd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/app/composer/qgscomposerlegendwidget.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,13 @@ void QgsComposerLegendWidget::on_mRemoveToolButton_clicked()
684684
return;
685685
}
686686

687-
QModelIndexList selection = selectionModel->selectedIndexes();
688-
for ( int i = selection.size() - 1; i >= 0; --i )
687+
QList<QPersistentModelIndex> indexes;
688+
foreach(const QModelIndex &index, selectionModel->selectedIndexes())
689+
indexes << index;
690+
691+
foreach(const QPersistentModelIndex index, indexes)
689692
{
690-
QModelIndex parentIndex = selection.at( i ).parent();
691-
itemModel->removeRow( selection.at( i ).row(), parentIndex );
693+
itemModel->removeRow( index.row(), index.parent() );
692694
}
693695

694696
mLegend->adjustBoxSize();

0 commit comments

Comments
 (0)