Skip to content

Commit

Permalink
Allow editing joins by double clicking on them in list
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 10, 2016
1 parent acedb39 commit 50a6ed0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -1156,13 +1156,18 @@ void QgsVectorLayerProperties::on_mButtonAddJoin_clicked()
void QgsVectorLayerProperties::on_mButtonEditJoin_clicked()
{
QTreeWidgetItem* currentJoinItem = mJoinTreeWidget->currentItem();
if ( !mLayer || !currentJoinItem )
on_mJoinTreeWidget_itemDoubleClicked( currentJoinItem, 0 );
}

void QgsVectorLayerProperties::on_mJoinTreeWidget_itemDoubleClicked( QTreeWidgetItem* item, int )
{
if ( !mLayer || !item )
{
return;
}

QList<QgsMapLayer*> joinedLayers;
QString joinLayerId = currentJoinItem->data( 0, Qt::UserRole ).toString();
QString joinLayerId = item->data( 0, Qt::UserRole ).toString();
const QList< QgsVectorJoinInfo >& joins = mLayer->vectorJoins();
int j = -1;
for ( int i = 0; i < joins.size(); ++i )
Expand Down Expand Up @@ -1191,7 +1196,7 @@ void QgsVectorLayerProperties::on_mButtonEditJoin_clicked()

// remove old join
mLayer->removeJoin( joinLayerId );
int idx = mJoinTreeWidget->indexOfTopLevelItem( currentJoinItem );
int idx = mJoinTreeWidget->indexOfTopLevelItem( item );
mJoinTreeWidget->takeTopLevelItem( idx );

// add the new edited
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsvectorlayerproperties.h
Expand Up @@ -123,6 +123,7 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private

void on_mButtonAddJoin_clicked();
void on_mButtonEditJoin_clicked();
void on_mJoinTreeWidget_itemDoubleClicked( QTreeWidgetItem *item, int column );
void on_mButtonRemoveJoin_clicked();

void on_mSimplifyDrawingGroupBox_toggled( bool checked );
Expand Down

0 comments on commit 50a6ed0

Please sign in to comment.