示例#1
0
void XLineEdit::sParse()
{
  if (validator() && validator()->inherits("QDoubleValidator"))
  {
    QRegExp zeroRegex(QString("^[0") + QLocale().groupSeparator() + "]*" +
                      QLocale().decimalPoint() + "0*$");
    if (! text().isEmpty() && toDouble() == 0 && ! text().contains(zeroRegex))
      setText("");
  }
}
示例#2
0
void XLineEdit::sParse()
{
  if (validator() && validator()->inherits("QDoubleValidator"))
  {
    QRegExp zeroRegex(QString("^[0") + QLocale().groupSeparator() + "]*" +
                      QLocale().decimalPoint() + "0*$");
    if (! text().isEmpty() && toDouble() == 0 && ! text().contains(zeroRegex))
    {
      _valid = false;
      setText("");
    }
    else _valid = true;
  }
  if (DEBUG)
    qDebug("%s::sParse() _valid = %d",
           objectName().isEmpty() ? "XLineEdit" : qPrintable(objectName()),
           _valid);
}