From 7e53f1f8e2c957ba2af48b650b94b460236e6fc8 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 20 Mar 2019 11:54:05 +0300 Subject: [PATCH] Issue #2888: Use only ASCII symbols for parameters names --- src/XGUI/XGUI_Tools.cpp | 16 ++++++++++++++++ src/XGUI/XGUI_Tools.h | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/src/XGUI/XGUI_Tools.cpp b/src/XGUI/XGUI_Tools.cpp index 104eee456..9ec6c6b28 100644 --- a/src/XGUI/XGUI_Tools.cpp +++ b/src/XGUI/XGUI_Tools.cpp @@ -147,11 +147,27 @@ bool canRemoveOrRename(QWidget* theParent, const std::set& theFeatur return aResult; } +//****************************************************************** +bool isAscii(const QString& theStr) +{ + char aCh; + for (int i = 0; i < theStr.size(); i++) { + aCh = theStr[i].toLatin1(); + if (aCh == 0) + return false; + } + return true; +} + //****************************************************************** bool canRename(const ObjectPtr& theObject, const QString& theName) { std::string aType = theObject->groupName(); if (aType == ModelAPI_ResultParameter::group()) { + // For parameters names only ASCII symbols have to be used + if (!isAscii(theName)) + return false; + double aValue; ResultParameterPtr aParam; if (ModelAPI_Tools::findVariable(theObject->document(), diff --git a/src/XGUI/XGUI_Tools.h b/src/XGUI/XGUI_Tools.h index 98178651f..2bcb33228 100644 --- a/src/XGUI/XGUI_Tools.h +++ b/src/XGUI/XGUI_Tools.h @@ -109,6 +109,12 @@ bool XGUI_EXPORT canRemoveOrRename(QWidget* theParent, const std::set