Skip to content

Commit

Permalink
Merge pull request #30451 from elpaso/show-json-in-identify
Browse files Browse the repository at this point in the history
Fix json(b) representation on feature identify
  • Loading branch information
elpaso committed Jun 28, 2019
2 parents ea27d55 + e9d1a6d commit e51c110
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -80,7 +80,8 @@
#include "qgsgui.h"
#include "qgsexpressioncontextutils.h"
#include "qgsidentifymenu.h"

#include "qgsjsonutils.h"
#include <nlohmann/json.hpp>

QgsIdentifyResultsWebView::QgsIdentifyResultsWebView( QWidget *parent ) : QgsWebView( parent )
{
Expand Down Expand Up @@ -907,10 +908,14 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
formattedValue = QLocale().toString( val, 'f', 0 );
}
}
else
else if ( ! formattedValue.isEmpty() )
{
isString = true;
}
else
{
formattedValue = QString::fromStdString( QgsJsonUtils::jsonFromVariant( value ).dump() );
}
}
QTreeWidgetItem *attrItem = new QTreeWidgetItem( { fields.at( i ).name(), formattedValue } );
featItem->addChild( attrItem );
Expand Down

0 comments on commit e51c110

Please sign in to comment.