Skip to content
Permalink
Browse files

Possibility to delete multiple composer legend entries at once

  • Loading branch information
mhugent committed Jun 16, 2011
1 parent 53eb763 commit 608d3947f2b06178ff42de08e4b96e5a8045f033
Showing with 19 additions and 11 deletions.
  1. +10 −5 src/app/composer/qgscomposerlegendwidget.cpp
  2. +9 −6 src/ui/qgscomposerlegendwidgetbase.ui
@@ -442,16 +442,21 @@ void QgsComposerLegendWidget::on_mRemoveToolButton_clicked()
return;
}

QModelIndex currentIndex = mItemTreeView->currentIndex();
if ( !currentIndex.isValid() )
mLegend->beginCommand( "Legend item removed" );

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

QModelIndex parentIndex = currentIndex.parent();
QModelIndexList selection = selectionModel->selectedIndexes();
for( int i = selection.size() - 1; i >= 0; --i )
{
QModelIndex parentIndex = selection.at( i ).parent();
itemModel->removeRow( selection.at( i ).row(), parentIndex );
}

mLegend->beginCommand( "Legend item removed" );
itemModel->removeRow( currentIndex.row(), parentIndex );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -33,8 +33,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>474</height>
<width>367</width>
<height>472</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@@ -48,8 +48,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>338</width>
<height>404</height>
<width>349</width>
<height>398</height>
</rect>
</property>
<attribute name="label">
@@ -183,8 +183,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>351</width>
<height>394</height>
<width>349</width>
<height>398</height>
</rect>
</property>
<attribute name="label">
@@ -215,6 +215,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ContiguousSelection</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>

0 comments on commit 608d394

Please sign in to comment.
You can’t perform that action at this time.