evalspinbox wheel
This commit is contained in:
@@ -315,7 +315,7 @@ void EvalSpinBox::stepByDouble(double steps) {
|
||||
if (eval->check(t)) {
|
||||
t = eval->expression();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
/* QRegExp re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
QRegExp re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
int pos = 0;
|
||||
if ((pos = re.indexIn(t)) != -1) {
|
||||
double v = t.mid(pos, re.matchedLength()).toDouble();
|
||||
@@ -326,9 +326,19 @@ void EvalSpinBox::stepByDouble(double steps) {
|
||||
double v = steps;
|
||||
t = QString::number(v) + t;
|
||||
}
|
||||
#else*/
|
||||
#else
|
||||
QRegularExpression re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
/// TODO andrey
|
||||
QRegularExpressionMatchIterator i = re.globalMatch(t);
|
||||
if (i.hasNext()) {
|
||||
QRegularExpressionMatch match = i.next();
|
||||
double v = t.mid(match.capturedStart(), match.capturedLength()).toDouble();
|
||||
v += steps;
|
||||
t.remove(match.capturedStart(), match.capturedLength());
|
||||
t.insert(match.capturedStart(), QString::number(v));
|
||||
} else {
|
||||
double v = steps;
|
||||
t = QString::number(v) + t;
|
||||
}
|
||||
#endif
|
||||
eval->check(t);
|
||||
lineEdit()->setText(eval->expression());
|
||||
|
||||
Reference in New Issue
Block a user