Skip to content

Commit

Permalink
allow editing and deleting vector join when child join item is select…
Browse files Browse the repository at this point in the history
…ed (fix #29709)
  • Loading branch information
alexbruy authored and nyalldawson committed Jan 30, 2025
1 parent 4dcf3b4 commit 4e23e78
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/gui/vector/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,8 +1305,16 @@ void QgsVectorLayerProperties::mJoinTreeWidget_itemDoubleClicked( QTreeWidgetIte
return;
}

// if current item is a child item, we should use its parent to be able to edit join
QTreeWidgetItem *currentJoinItem = item;
if ( item->parent() )
{
currentJoinItem = item->parent();
}


QList<QgsMapLayer *> joinedLayers;
QString joinLayerId = item->data( 0, Qt::UserRole ).toString();
QString joinLayerId = currentJoinItem->data( 0, Qt::UserRole ).toString();
const QList<QgsVectorLayerJoinInfo> &joins = mLayer->vectorJoins();
int j = -1;
for ( int i = 0; i < joins.size(); ++i )
Expand Down Expand Up @@ -1478,6 +1486,12 @@ void QgsVectorLayerProperties::openPanel( QgsPanelWidget *panel )
void QgsVectorLayerProperties::mButtonRemoveJoin_clicked()
{
QTreeWidgetItem *currentJoinItem = mJoinTreeWidget->currentItem();
// if current item is a child item, we should use its parent to be able to remove join
if ( currentJoinItem && currentJoinItem->parent() )
{
currentJoinItem = mJoinTreeWidget->currentItem()->parent();
}

if ( !mLayer || !currentJoinItem )
{
return;
Expand Down

0 comments on commit 4e23e78

Please sign in to comment.