[PyQt] Qstring %L omit thousand separator

Samuele Carcagno sam.carcagno at gmail.com
Mon Jun 14 17:32:07 BST 2010


I would like to convert a number to a localized string without the thousands separator,
I set the numberOptions to omit the group separator. This seems to work with the 
locale.toString() function, but not with the QString('%L1').arg() syntax.
I'm attaching a short example below. Do you know why this happens?
Am I missing something to make it work with the  QString('%L1').arg() syntax?

I am on Python 2.6.5 - Qt 4.6.2 - PyQt 4.7.2 on Kubuntu Lucid

from PyQt4.QtCore import*
from PyQt4.QtGui import*

thisLoc = QLocale(QLocale.English, QLocale.UnitedKingdom)
thisLoc.setNumberOptions(thisLoc.OmitGroupSeparator | thisLoc.RejectGroupSeparator)
#12345.6 this works correctly
# 12,345.6 this doesn't work



More information about the PyQt mailing list