Skip to content

Commit 4234ad5

Browse files
pvalseccm-kuhn
authored andcommittedNov 8, 2016
Relation managment: enable the remove button when selection
If nothing is selected, this button is doing nothing.
1 parent aaa3117 commit 4234ad5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎src/app/qgsrelationmanagerdialog.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ QgsRelationManagerDialog::QgsRelationManagerDialog( QgsRelationManager* relation
2525
, mRelationManager( relationMgr )
2626
{
2727
setupUi( this );
28+
29+
mBtnRemoveRelation->setEnabled( false );
30+
connect( mRelationsTable->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsRelationManagerDialog::onSelectionChanged );
2831
}
2932

3033
QgsRelationManagerDialog::~QgsRelationManagerDialog()
@@ -158,3 +161,7 @@ QList< QgsRelation > QgsRelationManagerDialog::relations()
158161
return relations;
159162
}
160163

164+
void QgsRelationManagerDialog::onSelectionChanged()
165+
{
166+
mBtnRemoveRelation->setEnabled( mRelationsTable->selectionModel()->hasSelection() );
167+
}

‎src/app/qgsrelationmanagerdialog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ class APP_EXPORT QgsRelationManagerDialog : public QWidget, private Ui::QgsRelat
3737
void addRelation( const QgsRelation& rel );
3838
QList< QgsRelation > relations();
3939

40-
public slots:
40+
private slots:
4141
void on_mBtnAddRelation_clicked();
4242
void on_mBtnDiscoverRelations_clicked();
4343
void on_mBtnRemoveRelation_clicked();
44+
void onSelectionChanged();
4445

4546
private:
4647
QgsRelationManager* mRelationManager;

0 commit comments

Comments
 (0)
Please sign in to comment.