Skip to content
Permalink
Browse files

[ui] improve metadata feature count string

- use unknown instead of -1
- use thousands separator
  • Loading branch information
nirvn committed Aug 17, 2018
1 parent 59dbe0e commit 1f31a9783cd7a4b2b3809a12e0d8d949ce4fa1c3
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/core/qgsvectorlayer.cpp
@@ -4220,7 +4220,9 @@ QString QgsVectorLayer::htmlMetadata() const
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Unit" ) + QStringLiteral( "</td><td>" ) + QgsUnitTypes::toString( crs().mapUnits() ) + QStringLiteral( "</td></tr>\n" );

// feature count
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Feature count" ) + QStringLiteral( "</td><td>" ) + QString::number( featureCount() ) + QStringLiteral( "</td></tr>\n" );
QLocale locale = QLocale();
locale.setNumberOptions( locale.numberOptions() &= ~QLocale::NumberOption::OmitGroupSeparator );

This comment has been minimized.

Copy link
@elpaso

elpaso Sep 24, 2018

Contributor

@nirvn there is now a global settings about number formatting, I believe that for consistency you should just use the default locale with QLocale(); and without settings any option.

myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Feature count" ) + QStringLiteral( "</td><td>" ) + ( featureCount() == -1 ? tr( "unknown" ) : locale.toString( ( qlonglong )featureCount() ) ) + QStringLiteral( "</td></tr>\n" );

// End Provider section
myMetadata += QLatin1String( "</table>\n<br><br>" );

0 comments on commit 1f31a97

Please sign in to comment.
You can’t perform that action at this time.