Strange behavior of .arg()
Unsolved
QML and Qt Quick
-
Hello,
I try to format string "%1/%2/%3" with numbers and found that arg() method can't properly format that string if we parse number from string and put it in an arg() function
For example:
var string_number = "1234567" var formatted_string = "%1/%2/%3".arg(parseInt(string_number)).arg(12345).arg(1234) Result: formatted_string = 1.23457e+06/12345/1234 Expected: formatted_string = 123457/12345/1234 console.log(parseInt(string_number)) -> 1234567
As I remember in older Qt version (5.6) this works as it expected, but now I try to use this code in 5.12+ and all strings that contains more than 6 characters (numbers) converted into double by arg() function
Can anyone explain me why Qt arg() works like that? And is there any way to make it work without using toFixed(0) for example?
-
@lolopolosko perhaps a bit wrong question, but why do you need to parse the integer at all?
arg()
can print strings, too.