From 3e4951a9ae163c68a139d38124f30d7754477892 Mon Sep 17 00:00:00 2001 From: Alexander Bruy Date: Tue, 28 Jan 2025 18:56:03 +0000 Subject: [PATCH 1/2] allow editing and deleting vector join when child join item is selected (fix #29709) --- src/gui/vector/qgsvectorlayerproperties.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gui/vector/qgsvectorlayerproperties.cpp b/src/gui/vector/qgsvectorlayerproperties.cpp index 7c90256e2898..03d443228cca 100644 --- a/src/gui/vector/qgsvectorlayerproperties.cpp +++ b/src/gui/vector/qgsvectorlayerproperties.cpp @@ -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 joinedLayers; - QString joinLayerId = item->data( 0, Qt::UserRole ).toString(); + QString joinLayerId = currentJoinItem->data( 0, Qt::UserRole ).toString(); const QList &joins = mLayer->vectorJoins(); int j = -1; for ( int i = 0; i < joins.size(); ++i ) @@ -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; From 4f8fbc633afc17ea9b6b365ca2253a7420f24f51 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 30 Jan 2025 13:53:46 +1000 Subject: [PATCH 2/2] Update src/gui/vector/qgsvectorlayerproperties.cpp --- src/gui/vector/qgsvectorlayerproperties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/vector/qgsvectorlayerproperties.cpp b/src/gui/vector/qgsvectorlayerproperties.cpp index 03d443228cca..87deb7059336 100644 --- a/src/gui/vector/qgsvectorlayerproperties.cpp +++ b/src/gui/vector/qgsvectorlayerproperties.cpp @@ -1489,7 +1489,7 @@ void QgsVectorLayerProperties::mButtonRemoveJoin_clicked() // 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(); + currentJoinItem = currentJoinItem->parent(); } if ( !mLayer || !currentJoinItem )