Skip to content
Permalink
Browse files
User friendly display string for geom column
  • Loading branch information
m-kuhn committed Nov 19, 2021
1 parent e3fa91b commit c5ac87a5f857d483762a2ccd5e0f13d667b0f553
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/core/qgsfield.cpp
@@ -19,6 +19,7 @@
#include "qgis.h"
#include "qgsapplication.h"
#include "qgssettings.h"
#include "qgsreferencedgeometry.h"

#include <QDataStream>
#include <QIcon>
@@ -258,6 +259,15 @@ QString QgsField::displayString( const QVariant &v ) const
return QgsApplication::nullRepresentation();
}

if ( v.userType() == QMetaType::type( "QgsReferencedGeometry" ) )
{
QgsReferencedGeometry geom = qvariant_cast<QgsReferencedGeometry>( v );
if( geom.isEmpty() )
return QgsApplication::nullRepresentation();
else
return QStringLiteral( "%1 [%2]" ).arg( geom.asWkt(), geom.crs().userFriendlyIdentifier() );
}

// Special treatment for numeric types if group separator is set or decimalPoint is not a dot
if ( d->type == QVariant::Double )
{

0 comments on commit c5ac87a

Please sign in to comment.