Skip to content

Commit

Permalink
[GUI] Identification result: fix warning 'CRITICAL Qt : QTableWidget:…
Browse files Browse the repository at this point in the history
… cannot insert an item that is already owned by another QTableWidget' (fixes #37215)

(cherry picked from commit 079f340)
  • Loading branch information
rouault authored and nyalldawson committed Oct 23, 2020
1 parent 6c70e9e commit 3430bbd
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -1013,20 +1013,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 );

Expand Down

0 comments on commit 3430bbd

Please sign in to comment.