+ change selectNumber() to check against the locale signs
This commit is contained in:
parent
17e2737062
commit
b8df4593c9
|
@ -450,21 +450,27 @@ void InputField::setHistorySize(int i)
|
||||||
|
|
||||||
void InputField::selectNumber(void)
|
void InputField::selectNumber(void)
|
||||||
{
|
{
|
||||||
QByteArray str = text().toLatin1();
|
QString str = text();
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) {
|
QChar d = locale().decimalPoint();
|
||||||
if (*it >= '0' && *it <= '9')
|
QChar g = locale().groupSeparator();
|
||||||
|
QChar n = locale().negativeSign();
|
||||||
|
|
||||||
|
for (QString::iterator it = str.begin(); it != str.end(); ++it) {
|
||||||
|
if (it->isDigit())
|
||||||
i++;
|
i++;
|
||||||
else if (*it == ',' || *it == '.')
|
else if (*it == d)
|
||||||
i++;
|
i++;
|
||||||
else if (*it == '-')
|
else if (*it == g)
|
||||||
|
i++;
|
||||||
|
else if (*it == n)
|
||||||
i++;
|
i++;
|
||||||
else // any non-number character
|
else // any non-number character
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelection(0,i);
|
setSelection(0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputField::showEvent(QShowEvent * event)
|
void InputField::showEvent(QShowEvent * event)
|
||||||
|
|
|
@ -326,15 +326,21 @@ void QuantitySpinBox::clear()
|
||||||
|
|
||||||
void QuantitySpinBox::selectNumber()
|
void QuantitySpinBox::selectNumber()
|
||||||
{
|
{
|
||||||
QByteArray str = lineEdit()->text().toLatin1();
|
QString str = lineEdit()->text();
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) {
|
QChar d = locale().decimalPoint();
|
||||||
if (*it >= '0' && *it <= '9')
|
QChar g = locale().groupSeparator();
|
||||||
|
QChar n = locale().negativeSign();
|
||||||
|
|
||||||
|
for (QString::iterator it = str.begin(); it != str.end(); ++it) {
|
||||||
|
if (it->isDigit())
|
||||||
i++;
|
i++;
|
||||||
else if (*it == ',' || *it == '.')
|
else if (*it == d)
|
||||||
i++;
|
i++;
|
||||||
else if (*it == '-')
|
else if (*it == g)
|
||||||
|
i++;
|
||||||
|
else if (*it == n)
|
||||||
i++;
|
i++;
|
||||||
else // any non-number character
|
else // any non-number character
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user