From 87b61dadaa5a82ff460f869c4b0498db0de70e85 Mon Sep 17 00:00:00 2001 From: cutefishd Date: Mon, 29 Mar 2021 17:05:05 +0800 Subject: [PATCH] Fix symbol error --- calcengine.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/calcengine.cpp b/calcengine.cpp index ee2e417..342b169 100644 --- a/calcengine.cpp +++ b/calcengine.cpp @@ -28,7 +28,13 @@ CalcEngine::CalcEngine(QObject *parent) QString CalcEngine::eval(const QString &expr) { - m_evaluator->setExpression(expr); + QString text = expr; + text = text.replace("+", "+"); + text = text.replace("-", "-"); + text = text.replace("×", "*"); + text = text.replace("÷", "/"); + + m_evaluator->setExpression(text); m_evaluator->eval(); if (m_evaluator->error().isEmpty()) {