Skip to content
Permalink
Browse files

[GUI] Identification result: fix warning 'CRITICAL Qt : QTableWidget:…

… cannot insert an item that is already owned by another QTableWidget' (fixes #37215)
  • Loading branch information
rouault authored and nyalldawson committed Sep 15, 2020
1 parent 53c5c33 commit 079f340e99eedce0007aebfbdc1914f8e6bb7cc0
Showing with 1 addition and 5 deletions.
  1. +1 −5 src/app/qgsidentifyresultsdialog.cpp
@@ -1088,20 +1088,16 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
tblResults->setItem( j, 0, item );
tblResults->setItem( j, 1, new QTableWidgetItem( QString::number( i + 1 ) ) );
tblResults->setItem( j, 2, new QTableWidgetItem( it.key() ) );
tblResults->setItem( j, 3, new QTableWidgetItem( it.value() ) );

bool foundLinks = false;
QString links = QgsStringUtils::insertLinks( it.value(), &foundLinks );
if ( foundLinks )
{
auto valueLabel { qgis::make_unique<QLabel>( links ) };
valueLabel->setOpenExternalLinks( true );
tblResults->setItem( j, 3, item );
tblResults->setCellWidget( j, 3, valueLabel.release() );
}
else
{
tblResults->setItem( j, 3, new QTableWidgetItem( it.value() ) );
}

tblResults->resizeRowToContents( j );

0 comments on commit 079f340

Please sign in to comment.
You can’t perform that action at this time.