File tree 2 files changed +19
-11
lines changed
2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -442,16 +442,21 @@ void QgsComposerLegendWidget::on_mRemoveToolButton_clicked()
442
442
return ;
443
443
}
444
444
445
- QModelIndex currentIndex = mItemTreeView ->currentIndex ();
446
- if ( !currentIndex.isValid () )
445
+ mLegend ->beginCommand ( " Legend item removed" );
446
+
447
+ QItemSelectionModel* selectionModel = mItemTreeView ->selectionModel ();
448
+ if ( !selectionModel )
447
449
{
448
450
return ;
449
451
}
450
452
451
- QModelIndex parentIndex = currentIndex.parent ();
453
+ QModelIndexList selection = selectionModel->selectedIndexes ();
454
+ for ( int i = selection.size () - 1 ; i >= 0 ; --i )
455
+ {
456
+ QModelIndex parentIndex = selection.at ( i ).parent ();
457
+ itemModel->removeRow ( selection.at ( i ).row (), parentIndex );
458
+ }
452
459
453
- mLegend ->beginCommand ( " Legend item removed" );
454
- itemModel->removeRow ( currentIndex.row (), parentIndex );
455
460
mLegend ->adjustBoxSize ();
456
461
mLegend ->update ();
457
462
mLegend ->endCommand ();
Original file line number Diff line number Diff line change 33
33
<rect >
34
34
<x >0</x >
35
35
<y >0</y >
36
- <width >369 </width >
37
- <height >474 </height >
36
+ <width >367 </width >
37
+ <height >472 </height >
38
38
</rect >
39
39
</property >
40
40
<layout class =" QGridLayout" name =" gridLayout_3" >
48
48
<rect >
49
49
<x >0</x >
50
50
<y >0</y >
51
- <width >338 </width >
52
- <height >404 </height >
51
+ <width >349 </width >
52
+ <height >398 </height >
53
53
</rect >
54
54
</property >
55
55
<attribute name =" label" >
183
183
<rect >
184
184
<x >0</x >
185
185
<y >0</y >
186
- <width >351 </width >
187
- <height >394 </height >
186
+ <width >349 </width >
187
+ <height >398 </height >
188
188
</rect >
189
189
</property >
190
190
<attribute name =" label" >
215
215
<verstretch >0</verstretch >
216
216
</sizepolicy >
217
217
</property >
218
+ <property name =" selectionMode" >
219
+ <enum >QAbstractItemView::ContiguousSelection</enum >
220
+ </property >
218
221
<property name =" wordWrap" >
219
222
<bool >false</bool >
220
223
</property >
You can’t perform that action at this time.
0 commit comments