Details
Description
Hi,
I am having some issues using toString function from QLocale since I moved from PyQt5. My locale country is Spain, in case it matters for some region options. For trying to reproduce the following cases you can create a locale object first from QtCore.
Negative numbers support:
locale.toString(-4) --> OverflowError. As is an integer number it should detect it and convert it, as is supported in the API
Wrong decimal separator representation:
locale.toString(1234) --> 1234 (thousand separator is missing)
locale.toString(12345) --> 12.345 (thousand separator is correct)
locale.toString(float(3355443), 'f', 3) --> 3355.443,000 (thousand separator is missing)
Supported signatures:
When you get a TypeError exception a supported signatures option list appears. As it seems that the argument must be the right/excepted type when you could each function, it would be nice to get the different overload functions in the description as in the documented API.
This is the API documentation for QLocale.toString() function.
Thanks for your help.
Iván
Python 3.10 Qt 6.4.3 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.3.0) toString(1234)= 1234 toString(12345)= 12.345 toString(float(3355443), 'f', 3)= 3355.443,000 pyside268.py:16: RuntimeWarning: libshiboken: Overflow: Value -4 exceeds limits of type [unsigned] "m" (8bytes). print("toString(-4)=", spanish.toString(-4)) Traceback (most recent call last): File "/data1/kleint/projects/pyside268.py", line 16, in <module> print("toString(-4)=", spanish.toString(-4)) OverflowError
Attachments
Issue Links
- is duplicated by
-
QTBUG-109652 QLocale.toString() issues
- Closed
- relates to
-
PYSIDE-2133 QLocale.toCurrencyString() omits decimals
- Closed
- resulted in
-
QTBUG-109652 QLocale.toString() issues
- Closed
-
QTBUG-109955 Implement system query for digit grouping rules
- In Review
For Gerrit Dashboard: PYSIDE-2168 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
452682,3 | PySide6: Fix negative values causing an error in QLocale.toString() | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
452712,2 | shiboken6: Add order depending on type range for C++ primitive types to the overload sorter | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
452952,2 | PySide6: Fix negative values causing an error in QLocale.toString() | 6.4 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
452962,2 | PySide6: Fix negative values causing an error in QLocale.toString() | tqtc/lts-6.2 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |