Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
I have example Text. It show 11.111111. How to specify how many digits it must show after comma? I want 2 digits. Like 11.11.
Text { anchors.fill: parent verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter font.pointSize: 0.6*parent.height text: 11.111111 }
text: Number(11.111111).toFixed(2)
I thought this would work, too, but it doesn't:
text: Number(11.111111).toLocaleString("de_DE", 'f', 2)
Perhaps someone else can shed some light on this.
@mzimmers said in Text component. double variable as source. Number of digits after comma.:
This works fine
text: qsTr("%1 km/h").arg(Number(rate.speed).toFixed(2))