Skip to content

Commit

Permalink
[ui] improve metadata feature count string
Browse files Browse the repository at this point in the history
- use unknown instead of -1
- use thousands separator
  • Loading branch information
nirvn committed Aug 17, 2018
1 parent 59dbe0e commit 1f31a97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -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>" );
Expand Down

0 comments on commit 1f31a97

Please sign in to comment.