Skip to content
Permalink
Browse files
truncate long strings
  • Loading branch information
m-kuhn committed Nov 19, 2021
1 parent 49f003f commit d61846ef902fad8a4af47a575379d48f7e1f7543
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/core/qgsfield.cpp
@@ -261,11 +261,18 @@ QString QgsField::displayString( const QVariant &v ) const

if ( v.userType() == QMetaType::type( "QgsReferencedGeometry" ) )
{
QgsReferencedGeometry geom = qvariant_cast<QgsReferencedGeometry>( v );
if( geom.isNull() )
return QgsApplication::nullRepresentation();
else
return QStringLiteral( "%1 [%2]" ).arg( geom.asWkt(), geom.crs().userFriendlyIdentifier() );
QgsReferencedGeometry geom = qvariant_cast<QgsReferencedGeometry>( v );
if ( geom.isNull() )
return QgsApplication::nullRepresentation();
else
{
QString formattedText = QStringLiteral( "%1 [%2]" ).arg( geom.asWkt(), geom.crs().userFriendlyIdentifier() );
if ( formattedText.length() >= 1000 )
{
formattedText = formattedText.left( 999 ) + QChar( 0x2026 );
}
return formattedText;
}
}

// Special treatment for numeric types if group separator is set or decimalPoint is not a dot

0 comments on commit d61846e

Please sign in to comment.