Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,10 @@ | |
** | ||
**********************************************************************/ | ||
|
||
#include<QObject> | ||
#include "rs_eventhandler.h" | ||
#include <QObject> | ||
#include <QRegularExpression> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
r-a-v-a-s
Author
Member
|
||
|
||
#include "rs_eventhandler.h" | ||
#include "rs_actioninterface.h" | ||
#include "rs_dialogfactory.h" | ||
#include "rs_commandevent.h" | ||
|
@@ -233,6 +234,8 @@ bool RS_EventHandler::cliCalculator(const QString& cmd) const | |
// RS_DIALOGFACTORY->commandMessage("No math expression"); | ||
return false; | ||
} | ||
// convert sin(45d) to sin(45*pi/180) | ||
str.replace(QRegularExpression("(\\d+)d"), "\\1*pi/180"); | ||
This comment has been minimized.
Sorry, something went wrong.
dxli
Member
|
||
bool ok=true; | ||
double result=RS_Math::eval(str,&ok); | ||
if(ok) | ||
|
2 comments
on commit 5a19752
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ries just mentioned, it's better to do muParser DefinePostfixOprt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started learning both C++ and Qt a few days ago.
Regex I know... DefinePostfixOprt is unknown to me. 😎
Do you want to code it?
This brakes compiling with QT4 as QRegularExpression it is only available in QT5 (http://doc.qt.io/qt-5/qregularexpression.html).
Officially QT4 seems to be one of the supported versions if not the default if I understand the README.md file correctly.
Is this a problem?