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