version 2.0.0_alpha
Important! All QtWraps macros renamed! Qt 6 support Graphic export feature qad_types cross-Qt small changes
This commit is contained in:
@@ -2,7 +2,11 @@
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
#include <QRegExp>
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
# include <QRegExp>
|
||||
#else
|
||||
# include <QRegularExpression>
|
||||
#endif
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include <QStyle>
|
||||
@@ -292,7 +296,13 @@ void EvalSpinBox::focusOutEvent(QFocusEvent * event) {
|
||||
|
||||
void EvalSpinBox::wheelEvent(QWheelEvent * event) {
|
||||
if (event->modifiers().testFlag(Qt::ShiftModifier))
|
||||
stepByDouble(event->delta() > 0 ? 0.1 : -0.1);
|
||||
stepByDouble(
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
event->delta()
|
||||
#else
|
||||
event->angleDelta().y()
|
||||
#endif
|
||||
> 0 ? 0.1 : -0.1);
|
||||
else
|
||||
QAbstractSpinBox::wheelEvent(event);
|
||||
}
|
||||
@@ -304,8 +314,8 @@ void EvalSpinBox::stepByDouble(double steps) {
|
||||
QString t = text();
|
||||
if (eval->check(t)) {
|
||||
t = eval->expression();
|
||||
//QRegExp re("(\\-?\\d+)");
|
||||
QRegExp re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
/* 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();
|
||||
@@ -316,6 +326,10 @@ void EvalSpinBox::stepByDouble(double steps) {
|
||||
double v = steps;
|
||||
t = QString::number(v) + t;
|
||||
}
|
||||
#else*/
|
||||
QRegularExpression re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
/// TODO andrey
|
||||
#endif
|
||||
eval->check(t);
|
||||
lineEdit()->setText(eval->expression());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user