X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetExprEditor.cpp;h=721ace1e0eb663b98ff45d8232b6fff25feb1c1a;hb=9afe243148ea67f2eccbd0afa419541424de451e;hp=c8b7efcbd53e3132094bcde5240b3290c65de1ca;hpb=2532fb2df83ee1ddd9ff3e8b381d3788eaa15b69;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp index c8b7efcbd..721ace1e0 100644 --- a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,21 +12,16 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/* - * ModuleBase_WidgetExprEditor.cpp - * - * Created on: Aug 28, 2014 - * Author: sbh - */ - #include #include +#include + #include #include #include @@ -109,9 +104,7 @@ void ExpressionEditor::performCompletion() QTextCursor aCursor = textCursor(); aCursor.select(QTextCursor::WordUnderCursor); const QString aPrefix = aCursor.selectedText(); - if (!aPrefix.isEmpty() && aPrefix.at(aPrefix.length() - 1).isLetter()) { - performCompletion(aPrefix); - } + performCompletion(aPrefix); } void ExpressionEditor::performCompletion(const QString& theCompletionPrefix) @@ -242,7 +235,7 @@ ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( QWidget* theParent, aMainLay->addWidget(myResultLabel); myEditor = new ExpressionEditor(this); myEditor->setMinimumHeight(20); - myEditor->setPlaceHolderText( QString::fromStdString( thePlaceHolder ) ); + myEditor->setPlaceHolderText( translate( thePlaceHolder ) ); aMainLay->addWidget(myEditor); this->setLayout(aMainLay); @@ -277,7 +270,7 @@ bool ModuleBase_WidgetExprEditor::storeValueCustom() AttributeStringPtr aStringAttr = aData->string(attributeID()); QString aWidgetValue = myEditor->toPlainText(); - aStringAttr->setValue(aWidgetValue.toStdString()); + aStringAttr->setValue(aWidgetValue.toStdWString()); updateObject(myFeature); // Try to get the value @@ -312,8 +305,12 @@ bool ModuleBase_WidgetExprEditor::restoreValueCustom() bool isBlocked = myEditor->blockSignals(true); QTextCursor aCursor = myEditor->textCursor(); int pos = aCursor.position(); - std::string aRestoredStr = aStringAttr->value(); - myEditor->setPlainText(QString::fromStdString(aRestoredStr)); + QString aRestoredStr; + if (aStringAttr->isUValue()) + aRestoredStr = QString::fromStdWString(Locale::Convert::toWString(aStringAttr->valueU())); + else + aRestoredStr = QString::fromStdString(aStringAttr->value()); + myEditor->setPlainText(aRestoredStr); aCursor.setPosition(pos); myEditor->setTextCursor(aCursor); myEditor->blockSignals(isBlocked);