Skip to content

Commit aaa3117

Browse files
pvalseccm-kuhn
authored andcommittedNov 8, 2016
Multi relation removal
Let the user select multiple relations and delete them.
1 parent 72fddb8 commit aaa3117

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎src/app/qgsrelationmanagerdialog.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,11 @@ void QgsRelationManagerDialog::on_mBtnDiscoverRelations_clicked()
134134

135135
void QgsRelationManagerDialog::on_mBtnRemoveRelation_clicked()
136136
{
137-
if ( mRelationsTable->currentIndex().isValid() )
138-
mRelationsTable->removeRow( mRelationsTable->currentItem()->row() );
137+
const QModelIndexList rows = mRelationsTable->selectionModel()->selectedRows();
138+
for ( int i = rows.size() - 1; i >= 0; --i )
139+
{
140+
mRelationsTable->removeRow( rows[i].row() );
141+
}
139142
}
140143

141144
QList< QgsRelation > QgsRelationManagerDialog::relations()

‎src/ui/qgsrelationmanagerdialogbase.ui

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
<layout class="QVBoxLayout" name="verticalLayout">
1717
<item>
1818
<widget class="QTableWidget" name="mRelationsTable">
19+
<property name="selectionBehavior">
20+
<enum>QAbstractItemView::SelectRows</enum>
21+
</property>
1922
<property name="sortingEnabled">
2023
<bool>true</bool>
2124
</property>

0 commit comments

Comments
 (0)
Please sign in to comment.