Skip to content

Commit

Permalink
truncate long strings
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 19, 2021
1 parent 49f003f commit d61846e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/core/qgsfield.cpp
Expand Up @@ -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
Expand Down

0 comments on commit d61846e

Please sign in to comment.