Changeset 561 for trunk/src/gui/widgets/qspinbox.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qspinbox.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 51 51 52 52 #include <math.h> 53 #include <float.h> 53 54 54 55 QT_BEGIN_NAMESPACE … … 61 62 #endif 62 63 63 static bool isIntermediateValueHelper(qint64 num, qint64 minimum, qint64 maximum, qint64 *match = 0);64 65 64 class QSpinBoxPrivate : public QAbstractSpinBoxPrivate 66 65 { 67 66 Q_DECLARE_PUBLIC(QSpinBox) 68 67 public: 69 QSpinBoxPrivate( QWidget *parent = 0);68 QSpinBoxPrivate(); 70 69 void emitSignals(EmitPolicy ep, const QVariant &); 71 70 … … 74 73 QVariant validateAndInterpret(QString &input, int &pos, 75 74 QValidator::State &state) const; 76 bool isIntermediateValue(const QString &str) const;77 QChar thousand;78 75 79 76 inline void init() { 77 Q_Q(QSpinBox); 78 q->setInputMethodHints(Qt::ImhDigitsOnly); 80 79 setLayoutItemMargins(QStyle::SE_SpinBoxLayoutItem); 81 80 } … … 86 85 Q_DECLARE_PUBLIC(QDoubleSpinBox) 87 86 public: 88 QDoubleSpinBoxPrivate( QWidget *parent = 0);87 QDoubleSpinBoxPrivate(); 89 88 void emitSignals(EmitPolicy ep, const QVariant &); 90 bool isIntermediateValue(const QString &str) const;91 89 92 90 virtual QVariant valueFromText(const QString &n) const; … … 97 95 // variables 98 96 int decimals; 99 QChar delimiter, thousand; 97 98 inline void init() { 99 Q_Q(QDoubleSpinBox); 100 q->setInputMethodHints(Qt::ImhFormattedNumbersOnly); 101 } 100 102 }; 101 103 … … 106 108 107 109 \ingroup basicwidgets 108 \mainclass 110 109 111 110 112 QSpinBox is designed to handle integers and discrete sets of … … 198 200 199 201 QSpinBox::QSpinBox(QWidget *parent) 200 : QAbstractSpinBox(*new QSpinBoxPrivate (parent), parent)202 : QAbstractSpinBox(*new QSpinBoxPrivate, parent) 201 203 { 202 204 Q_D(QSpinBox); … … 210 212 */ 211 213 QSpinBox::QSpinBox(QWidget *parent, const char *name) 212 : QAbstractSpinBox(*new QSpinBoxPrivate (parent), parent)214 : QAbstractSpinBox(*new QSpinBoxPrivate, parent) 213 215 { 214 216 Q_D(QSpinBox); … … 222 224 */ 223 225 QSpinBox::QSpinBox(int minimum, int maximum, int step, QWidget *parent, const char *name) 224 : QAbstractSpinBox(*new QSpinBoxPrivate (parent), parent)226 : QAbstractSpinBox(*new QSpinBoxPrivate, parent) 225 227 { 226 228 Q_D(QSpinBox); … … 285 287 d->prefix = prefix; 286 288 d->updateEdit(); 289 290 d->cachedSizeHint = QSize(); 291 updateGeometry(); 287 292 } 288 293 … … 319 324 d->suffix = suffix; 320 325 d->updateEdit(); 326 327 d->cachedSizeHint = QSize(); 328 updateGeometry(); 321 329 } 322 330 … … 455 463 QString QSpinBox::textFromValue(int value) const 456 464 { 457 Q_D(const QSpinBox);458 465 QString str = locale().toString(value); 459 466 if (qAbs(value) >= 1000 || value == INT_MIN) { 460 str.remove( d->thousand);467 str.remove(locale().groupSeparator()); 461 468 } 462 469 … … 507 514 void QSpinBox::fixup(QString &input) const 508 515 { 509 Q_D(const QSpinBox); 510 511 input.remove(d->thousand); 516 input.remove(locale().groupSeparator()); 512 517 } 513 518 … … 521 526 522 527 \ingroup basicwidgets 523 \mainclass 528 524 529 525 530 QDoubleSpinBox allows the user to choose a value by clicking the … … 591 596 */ 592 597 QDoubleSpinBox::QDoubleSpinBox(QWidget *parent) 593 : QAbstractSpinBox(*new QDoubleSpinBoxPrivate(parent), parent) 594 { 598 : QAbstractSpinBox(*new QDoubleSpinBoxPrivate, parent) 599 { 600 Q_D(QDoubleSpinBox); 601 d->init(); 595 602 } 596 603 … … 818 825 interpreting doubles. 819 826 820 \warning The results might not be reliable with very high values821 for \a decimals.827 \warning The maximum value for \a decimals is DBL_MAX_10_EXP + 828 DBL_DIG (ie. 323) because of the limitations of the double type. 822 829 823 830 Note: The maximum, minimum and value might change as a result of … … 835 842 { 836 843 Q_D(QDoubleSpinBox); 837 d->decimals = q Max(0, decimals);844 d->decimals = qBound(0, decimals, DBL_MAX_10_EXP + DBL_DIG); 838 845 839 846 setRange(minimum(), maximum()); // make sure values are rounded … … 864 871 QString str = locale().toString(value, 'f', d->decimals); 865 872 if (qAbs(value) >= 1000.0) { 866 str.remove( d->thousand);873 str.remove(locale().groupSeparator()); 867 874 } 868 875 return str; … … 909 916 void QDoubleSpinBox::fixup(QString &input) const 910 917 { 911 Q_D(const QDoubleSpinBox); 912 913 input.remove(d->thousand); 918 input.remove(locale().groupSeparator()); 914 919 } 915 920 … … 921 926 */ 922 927 923 QSpinBoxPrivate::QSpinBoxPrivate( QWidget *parent)928 QSpinBoxPrivate::QSpinBoxPrivate() 924 929 { 925 930 minimum = QVariant((int)0); … … 928 933 singleStep = QVariant((int)1); 929 934 type = QVariant::Int; 930 const QString str = (parent ? parent->locale() : QLocale()).toString(4567);931 if (str.size() == 5) {932 thousand = QChar(str.at(1));933 }934 935 935 } 936 936 … … 976 976 977 977 /*! 978 \internal979 980 Return true if str can become a number which is between minimum and981 maximum or false if this is not possible.982 */983 984 bool QSpinBoxPrivate::isIntermediateValue(const QString &str) const985 {986 const int num = q_func()->locale().toInt(str, 0, 10);987 const int min = minimum.toInt();988 const int max = maximum.toInt();989 990 int numDigits = 0;991 int digits[10];992 int tmp = num;993 if (tmp == 0) {994 numDigits = 1;995 digits[0] = 0;996 } else {997 tmp = num;998 for (int i=0; tmp != 0; ++i) {999 digits[numDigits++] = qAbs(tmp % 10);1000 tmp /= 10;1001 }1002 }1003 1004 int failures = 0;1005 for (int number=min; /*number<=max*/; ++number) {1006 tmp = number;1007 for (int i=0; tmp != 0;) {1008 if (digits[i] == qAbs(tmp % 10)) {1009 if (++i == numDigits)1010 return true;1011 }1012 tmp /= 10;1013 }1014 if (failures++ == 500000) //upper bound1015 return true;1016 if (number == max) // needed for INT_MAX1017 break;1018 }1019 return false;1020 }1021 1022 /*!1023 978 \internal Multi purpose function that parses input, sets state to 1024 979 the appropriate state and returns the value it will be interpreted … … 1031 986 if (cachedText == input && !input.isEmpty()) { 1032 987 state = cachedState; 1033 QSBDEBUG() << "cachedText was " << "'" << cachedText << "'" << "state was "988 QSBDEBUG() << "cachedText was '" << cachedText << "' state was " 1034 989 << state << " and value was " << cachedValue; 1035 990 … … 1049 1004 state = QValidator::Intermediate; 1050 1005 QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num; 1051 } else if (copy.startsWith(QLatin1 String("-")) && min >= 0) {1006 } else if (copy.startsWith(QLatin1Char('-')) && min >= 0) { 1052 1007 state = QValidator::Invalid; // special-case -0 will be interpreted as 0 and thus not be invalid with a range from 0-100 1053 1008 } else { 1054 1009 bool ok = false; 1055 bool removedThousand = false; 1056 num = q_func()->locale().toInt(copy, &ok, 10); 1057 if (!ok && copy.contains(thousand) && (max >= 1000 || min <= -1000)) { 1058 const int s = copy.size(); 1059 copy.remove(thousand); 1060 pos = qMax(0, pos - (s - copy.size())); 1061 removedThousand = true; 1062 num = q_func()->locale().toInt(copy, &ok, 10); 1010 num = locale.toInt(copy, &ok, 10); 1011 if (!ok && copy.contains(locale.groupSeparator()) && (max >= 1000 || min <= -1000)) { 1012 QString copy2 = copy; 1013 copy2.remove(locale.groupSeparator()); 1014 num = locale.toInt(copy2, &ok, 10); 1063 1015 } 1064 1016 QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num; … … 1066 1018 state = QValidator::Invalid; 1067 1019 } else if (num >= min && num <= max) { 1068 state = removedThousand ? QValidator::Intermediate :QValidator::Acceptable;1020 state = QValidator::Acceptable; 1069 1021 } else if (max == min) { 1070 1022 state = QValidator::Invalid; … … 1074 1026 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; 1075 1027 } else { 1076 state = isIntermediateValue(copy) ? QValidator::Intermediate : QValidator::Invalid; 1077 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to " 1078 << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable"); 1028 state = QValidator::Intermediate; 1029 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Intermediate"; 1079 1030 } 1080 1031 } … … 1099 1050 */ 1100 1051 1101 QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate( QWidget *parent)1052 QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate() 1102 1053 { 1103 1054 minimum = QVariant(0.0); … … 1107 1058 decimals = 2; 1108 1059 type = QVariant::Double; 1109 const QString str = (parent ? parent->locale() : QLocale()).toString(4567.1);1110 if (str.size() == 6) {1111 delimiter = str.at(4);1112 thousand = QChar((ushort)0);1113 } else if (str.size() == 7) {1114 thousand = str.at(1);1115 delimiter = str.at(5);1116 }1117 Q_ASSERT(!delimiter.isNull());1118 1060 } 1119 1061 … … 1136 1078 1137 1079 1138 bool QDoubleSpinBoxPrivate::isIntermediateValue(const QString &str) const1139 {1140 QSBDEBUG() << "input is" << str << minimum << maximum;1141 qint64 dec = 1;1142 for (int i=0; i<decimals; ++i)1143 dec *= 10;1144 1145 const QLatin1Char dot('.');1146 1147 // I know QString::number() uses CLocale so I use dot1148 const QString minstr = QString::number(minimum.toDouble(), 'f', decimals);1149 bool ok;1150 qint64 min_left = minstr.left(minstr.indexOf(dot)).toLongLong(&ok);1151 if (!ok)1152 return false;1153 qint64 min_right = minstr.mid(minstr.indexOf(dot) + 1).toLongLong();1154 1155 const QString maxstr = QString::number(maximum.toDouble(), 'f', decimals);1156 qint64 max_left = maxstr.left(maxstr.indexOf(dot)).toLongLong(&ok);1157 if (!ok)1158 return true;1159 qint64 max_right = maxstr.mid(maxstr.indexOf(dot) + 1).toLongLong();1160 1161 const int dotindex = str.indexOf(delimiter);1162 const bool negative = maximum.toDouble() < 0;1163 qint64 left = 0, right = 0;1164 bool doleft = true;1165 bool doright = true;1166 if (dotindex == -1) {1167 left = str.toLongLong();1168 doright = false;1169 } else if (dotindex == 0 || (dotindex == 1 && str.at(0) == QLatin1Char('+'))) {1170 if (negative) {1171 QSBDEBUG() << __FILE__ << __LINE__ << "returns false";1172 return false;1173 }1174 doleft = false;1175 right = str.mid(dotindex + 1).toLongLong();1176 } else if (dotindex == 1 && str.at(0) == QLatin1Char('-')) {1177 if (!negative) {1178 QSBDEBUG() << __FILE__ << __LINE__ << "returns false";1179 return false;1180 }1181 doleft = false;1182 right = str.mid(dotindex + 1).toLongLong();1183 } else {1184 left = str.left(dotindex).toLongLong();1185 if (dotindex == str.size() - 1) {1186 doright = false;1187 } else {1188 right = str.mid(dotindex + 1).toLongLong();1189 }1190 }1191 if ((left >= 0 && max_left < 0 && !str.startsWith(QLatin1Char('-'))) || (left < 0 && min_left >= 0)) {1192 QSBDEBUG("returns false 0");1193 return false;1194 }1195 1196 qint64 match = min_left;1197 if (doleft && !isIntermediateValueHelper(left, min_left, max_left, &match)) {1198 QSBDEBUG() << __FILE__ << __LINE__ << "returns false";1199 return false;1200 }1201 if (doright) {1202 QSBDEBUG("match %lld min_left %lld max_left %lld", match, min_left, max_left);1203 if (!doleft) {1204 if (min_left == max_left) {1205 const bool ret = isIntermediateValueHelper(qAbs(left),1206 negative ? max_right : min_right,1207 negative ? min_right : max_right);1208 QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret;1209 return ret;1210 } else if (qAbs(max_left - min_left) == 1) {1211 const bool ret = isIntermediateValueHelper(qAbs(left), min_right, negative ? 0 : dec)1212 || isIntermediateValueHelper(qAbs(left), negative ? dec : 0, max_right);1213 QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret;1214 return ret;1215 } else {1216 const bool ret = isIntermediateValueHelper(qAbs(left), 0, dec);1217 QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret;1218 return ret;1219 }1220 }1221 if (match != min_left) {1222 min_right = negative ? dec : 0;1223 }1224 if (match != max_left) {1225 max_right = negative ? 0 : dec;1226 }1227 qint64 tmpl = negative ? max_right : min_right;1228 qint64 tmpr = negative ? min_right : max_right;1229 const bool ret = isIntermediateValueHelper(right, tmpl, tmpr);1230 QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret;1231 return ret;1232 }1233 QSBDEBUG() << __FILE__ << __LINE__ << "returns true";1234 return true;1235 }1236 1237 1080 /*! 1238 1081 \internal … … 1255 1098 double QDoubleSpinBoxPrivate::round(double value) const 1256 1099 { 1257 Q_Q(const QDoubleSpinBox); 1258 const QString strDbl = q->locale().toString(value, 'f', decimals); 1259 return q->locale().toDouble(strDbl); 1100 return QString::number(value, 'f', decimals).toDouble(); 1260 1101 } 1261 1102 … … 1272 1113 if (cachedText == input && !input.isEmpty()) { 1273 1114 state = cachedState; 1274 QSBDEBUG() << "cachedText was " << "'" << cachedText << "'" << "state was "1115 QSBDEBUG() << "cachedText was '" << cachedText << "' state was " 1275 1116 << state << " and value was " << cachedValue; 1276 1117 return cachedValue; … … 1291 1132 goto end; 1292 1133 case 1: 1293 if (copy.at(0) == delimiter1134 if (copy.at(0) == locale.decimalPoint() 1294 1135 || (plus && copy.at(0) == QLatin1Char('+')) 1295 1136 || (minus && copy.at(0) == QLatin1Char('-'))) { … … 1299 1140 break; 1300 1141 case 2: 1301 if (copy.at(1) == delimiter1142 if (copy.at(1) == locale.decimalPoint() 1302 1143 && ((plus && copy.at(0) == QLatin1Char('+')) || (minus && copy.at(0) == QLatin1Char('-')))) { 1303 1144 state = QValidator::Intermediate; … … 1308 1149 } 1309 1150 1310 if (copy.at(0) == thousand) {1151 if (copy.at(0) == locale.groupSeparator()) { 1311 1152 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; 1312 1153 state = QValidator::Invalid; 1313 1154 goto end; 1314 1155 } else if (len > 1) { 1315 const int dec = copy.indexOf( delimiter);1156 const int dec = copy.indexOf(locale.decimalPoint()); 1316 1157 if (dec != -1) { 1317 if (dec + 1 < copy.size() && copy.at(dec + 1) == delimiter&& pos == dec + 1) {1158 if (dec + 1 < copy.size() && copy.at(dec + 1) == locale.decimalPoint() && pos == dec + 1) { 1318 1159 copy.remove(dec + 1, 1); // typing a delimiter when you are on the delimiter 1319 1160 } // should be treated as typing right arrow … … 1325 1166 } 1326 1167 for (int i=dec + 1; i<copy.size(); ++i) { 1327 if (copy.at(i).isSpace() || copy.at(i) == thousand) {1168 if (copy.at(i).isSpace() || copy.at(i) == locale.groupSeparator()) { 1328 1169 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; 1329 1170 state = QValidator::Invalid; … … 1334 1175 const QChar &last = copy.at(len - 1); 1335 1176 const QChar &secondLast = copy.at(len - 2); 1336 if ((last == thousand|| last.isSpace())1337 && (secondLast == thousand|| secondLast.isSpace())) {1177 if ((last == locale.groupSeparator() || last.isSpace()) 1178 && (secondLast == locale.groupSeparator() || secondLast.isSpace())) { 1338 1179 state = QValidator::Invalid; 1339 1180 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; 1340 1181 goto end; 1341 } else if (last.isSpace() && (! thousand.isSpace() || secondLast.isSpace())) {1182 } else if (last.isSpace() && (!locale.groupSeparator().isSpace() || secondLast.isSpace())) { 1342 1183 state = QValidator::Invalid; 1343 1184 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; … … 1349 1190 { 1350 1191 bool ok = false; 1351 QLocale loc(q_func()->locale()); 1352 num = loc.toDouble(copy, &ok); 1353 QSBDEBUG() << __FILE__ << __LINE__ << loc << copy << num << ok; 1354 bool notAcceptable = false; 1192 num = locale.toDouble(copy, &ok); 1193 QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok; 1355 1194 1356 1195 if (!ok) { 1357 if ( thousand.isPrint()) {1358 if (max < 1000 && min > -1000 && copy.contains( thousand)) {1196 if (locale.groupSeparator().isPrint()) { 1197 if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) { 1359 1198 state = QValidator::Invalid; 1360 1199 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; … … 1364 1203 const int len = copy.size(); 1365 1204 for (int i=0; i<len- 1; ++i) { 1366 if (copy.at(i) == thousand && copy.at(i + 1) == thousand) {1205 if (copy.at(i) == locale.groupSeparator() && copy.at(i + 1) == locale.groupSeparator()) { 1367 1206 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; 1368 1207 state = QValidator::Invalid; … … 1371 1210 } 1372 1211 1373 const int s = copy.size(); 1374 copy.remove(thousand); 1375 pos = qMax(0, pos - (s - copy.size())); 1376 1377 1378 num = loc.toDouble(copy, &ok); 1379 QSBDEBUG() << thousand << num << copy << ok; 1212 QString copy2 = copy; 1213 copy2.remove(locale.groupSeparator()); 1214 num = locale.toDouble(copy2, &ok); 1215 QSBDEBUG() << locale.groupSeparator() << num << copy2 << ok; 1380 1216 1381 1217 if (!ok) { … … 1384 1220 goto end; 1385 1221 } 1386 notAcceptable = true;1387 1222 } 1388 1223 } … … 1392 1227 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; 1393 1228 } else if (num >= min && num <= max) { 1394 state = notAcceptable ? QValidator::Intermediate : QValidator::Acceptable; 1395 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to " 1396 << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable"); 1229 state = QValidator::Acceptable; 1230 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Acceptable"; 1397 1231 } else if (max == min) { // when max and min is the same the only non-Invalid input is max (or min) 1398 1232 state = QValidator::Invalid; … … 1403 1237 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; 1404 1238 } else { 1405 state = isIntermediateValue(copy) ? QValidator::Intermediate : QValidator::Invalid; 1406 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to " 1407 << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable"); 1239 state = QValidator::Intermediate; 1240 QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Intermediate"; 1408 1241 } 1409 1242 } … … 1462 1295 Use minimum() instead. 1463 1296 */ 1464 1465 /*!1466 \internal Returns whether \a str is a string which value cannot be1467 parsed but still might turn into something valid.1468 */1469 1470 static bool isIntermediateValueHelper(qint64 num, qint64 min, qint64 max, qint64 *match)1471 {1472 QSBDEBUG("%lld %lld %lld", num, min, max);1473 1474 if (num >= min && num <= max) {1475 if (match)1476 *match = num;1477 QSBDEBUG("returns true 0");1478 return true;1479 }1480 qint64 tmp = num;1481 1482 int numDigits = 0;1483 int digits[10];1484 if (tmp == 0) {1485 numDigits = 1;1486 digits[0] = 0;1487 } else {1488 tmp = qAbs(num);1489 for (int i=0; tmp > 0; ++i) {1490 digits[numDigits++] = tmp % 10;1491 tmp /= 10;1492 }1493 }1494 1495 int failures = 0;1496 qint64 number;1497 for (number=max; number>=min; --number) {1498 tmp = qAbs(number);1499 for (int i=0; tmp > 0;) {1500 if (digits[i] == (tmp % 10)) {1501 if (++i == numDigits) {1502 if (match)1503 *match = number;1504 QSBDEBUG("returns true 1");1505 return true;1506 }1507 }1508 tmp /= 10;1509 }1510 if (failures++ == 500000) { //upper bound1511 if (match)1512 *match = num;1513 QSBDEBUG("returns true 2");1514 return true;1515 }1516 }1517 QSBDEBUG("returns false");1518 return false;1519 }1520 1297 1521 1298 /*! \reimp */
Note:
See TracChangeset
for help on using the changeset viewer.