evalspinbox wheel
This commit is contained in:
@@ -820,6 +820,7 @@ void Graphic::exportGraphics(QString filename) {
|
||||
QMessageBox::critical(this, tr("Export graphics"), tr("Can`t open file \"%1\"!").arg(filename));
|
||||
return;
|
||||
}
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
f.resize(0);
|
||||
QTextStream ts(&f);
|
||||
ts << "#";
|
||||
@@ -854,6 +855,7 @@ void Graphic::exportGraphics(QString filename) {
|
||||
if (has_data)
|
||||
ts << line;
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -395,6 +395,9 @@
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -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