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)
  • Loading branch information
rouault committed Sep 15, 2020
1 parent 4fe3d2f commit 7f795a8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/app/qgsidentifyresultsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit 7f795a8

Please sign in to comment.