Adding selectNumber handling of locale, this wont work with groupseparators
This commit is contained in:
parent
5cfdabb45a
commit
83a5f1547f
|
@ -450,16 +450,17 @@ void InputField::setHistorySize(int i)
|
||||||
|
|
||||||
void InputField::selectNumber(void)
|
void InputField::selectNumber(void)
|
||||||
{
|
{
|
||||||
QByteArray str = text().toLatin1();
|
QString input = text();
|
||||||
|
fixup(input);
|
||||||
|
QByteArray str = input.toLatin1();
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
Base::Console().Message("%i", locale().negativeSign().toAscii());
|
|
||||||
|
|
||||||
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) {
|
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) {
|
||||||
if (*it >= '0' && *it <= '9')
|
if (*it >= '0' && *it <= '9')
|
||||||
i++;
|
i++;
|
||||||
else if (*it == ',' || *it == '.')
|
else if (*it == ',' || *it == '.')
|
||||||
i++;
|
i++;
|
||||||
else if (*it == '-' || *it == locale().negativeSign().toAscii())
|
else if (*it == '-' )
|
||||||
i++;
|
i++;
|
||||||
else // any non-number character
|
else // any non-number character
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -326,7 +326,9 @@ void QuantitySpinBox::clear()
|
||||||
|
|
||||||
void QuantitySpinBox::selectNumber()
|
void QuantitySpinBox::selectNumber()
|
||||||
{
|
{
|
||||||
QByteArray str = lineEdit()->text().toLatin1();
|
QString input = lineEdit()->text();
|
||||||
|
fixup(input);
|
||||||
|
QByteArray str = input.toLatin1();
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) {
|
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) {
|
||||||
|
@ -334,7 +336,7 @@ void QuantitySpinBox::selectNumber()
|
||||||
i++;
|
i++;
|
||||||
else if (*it == ',' || *it == '.')
|
else if (*it == ',' || *it == '.')
|
||||||
i++;
|
i++;
|
||||||
else if (*it == '-' || *it == locale().negativeSign().toAscii())
|
else if (*it == '-' )
|
||||||
i++;
|
i++;
|
||||||
else // any non-number character
|
else // any non-number character
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user