//I know this code does the job for positive numbers but not for all numbers.
text: qsTr ("+") + (some_positive_number)
//Is there a way that I can always display any number with its sign beside it?
//I know this code does the job for positive numbers but not for all numbers.
text: qsTr ("+") + (some_positive_number)
//Is there a way that I can always display any number with its sign beside it?
This should work fine in standard javascript:
(a - b > 0 ? "+" : "") + (a - b)
Note that:
There is little to no sense in using qsTr for + since its meaning is fairly localised and internationalised by default.
No need to calculate the difference of a - b thrice.