我想在没有数字格式的Qml Quick Controls 2 SpinBox
中显示数字:
SpinBox {
inputMethodHints: Qt.ImhDigitsOnly
from: 1000
to: 10000
}
我尝试设置不同的区域设置,但每次将数字显示为" 1.000"或" 1,000" (正确的是" 1000")。有没有办法强制无格式输出?
答案 0 :(得分:3)
您可以覆盖textFromValue
功能:
import QtQuick 2.8
import QtQuick.Controls 2.1
ApplicationWindow {
width: 400
height: 300
visible: true
SpinBox {
inputMethodHints: Qt.ImhDigitsOnly
from: 1000
to: 10000
textFromValue: function(value) {
return value;
}
}
}