Skip to content

Commit

Permalink
Fix crash when clicking on an hyperlink in identify
Browse files Browse the repository at this point in the history
Fixes #31226
  • Loading branch information
elpaso authored and nyalldawson committed Aug 21, 2019
1 parent 6cbfb36 commit 77e94fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -941,17 +941,18 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
{
attrItem->webView()->setZoomFactor( attrItem->webView()->zoomFactor() * ( currentFormat == QgsRaster::IdentifyFormatHtml ? 0.7 : 0.9 ) );
}
connect( attrItem->webView(), &QWebView::linkClicked, [ ]( const QUrl & url )
connect( attrItem->webView()->page(), &QWebPage::linkClicked, [ ]( const QUrl & url )
{
QDesktopServices::openUrl( url );
} );
#endif
featItem->addChild( attrItem ); // before setHtml()!
if ( !attributes.isEmpty() )
{
auto value { QgsStringUtils::insertLinks( attributes.begin().value() ) };
QString value { attributes.begin().value() };
if ( currentFormat == QgsRaster::IdentifyFormatText )
{
value = QgsStringUtils::insertLinks( value );
value.prepend( QStringLiteral( "<pre style=\"font-family: monospace;\">" ) ).append( QStringLiteral( "</pre>" ) );
}
attrItem->setHtml( value );
Expand Down

0 comments on commit 77e94fc

Please sign in to comment.