X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetExprEditor.cpp;h=c0e683f89751ae8fd1da7e52c00b5059919ba923;hb=e48efe1ec56a7d7e0d8a57fc05f8220b846ea995;hp=a7e7878e65d52e34722b4cf43f88c2a758e09006;hpb=3eedcd3fa7bfd2eea9337c24a5fcdd96f263340a;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp index a7e7878e6..c0e683f89 100644 --- a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp @@ -36,7 +36,7 @@ #include ExpressionEditor::ExpressionEditor(QWidget* theParent) -: QPlainTextEdit(theParent), myCompletedAndSelected(false), myIsModified(false) +: QPlainTextEdit(theParent), myCompletedAndSelected(false) { myCompleter = new QCompleter(this); myCompleter->setWidget(this); @@ -114,8 +114,6 @@ void ExpressionEditor::performCompletion(const QString& theCompletionPrefix) void ExpressionEditor::keyPressEvent(QKeyEvent* theEvent) { - bool anIsModified = myIsModified; - if (myCompletedAndSelected && handledCompletedAndSelected(theEvent)) return; myCompletedAndSelected = false; @@ -173,16 +171,6 @@ QString ExpressionEditor::placeHolderText() const return myPlaceHolderText; } -bool ExpressionEditor::isModified() const -{ - return myIsModified; -} - -void ExpressionEditor::clearModified() -{ - myIsModified = false; -} - void ExpressionEditor::paintEvent( QPaintEvent* theEvent ) { QPlainTextEdit::paintEvent( theEvent ); @@ -212,18 +200,8 @@ void ExpressionEditor::paintEvent( QPaintEvent* theEvent ) } } -bool ExpressionEditor::focusNextPrevChild(bool theIsNext) -{ - if (myIsModified) - emit editingFinished(); - emit valueStored(); - emit focusNextPrev(); - return QPlainTextEdit::focusNextPrevChild(theIsNext); -} - void ExpressionEditor::onTextChanged() { - myIsModified = true; emit valueModified(); } @@ -250,19 +228,17 @@ ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( QWidget* theParent, this->setLayout(aMainLay); connect(myEditor, SIGNAL(valueModified()), this, SIGNAL(valuesModified())); - //connect(myEditor, SIGNAL(editingFinished()), this, SLOT(onTextChanged())); - connect(myEditor, SIGNAL(valueStored()), this, SLOT(onTextChanged())); - connect(myEditor, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev())); - connect(myEditor, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*))); - /// The signal about key release on the control, that corresponds to the attribute - /// \param theEvent key release event } ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor() { } +void ModuleBase_WidgetExprEditor::initializeValueByActivate() +{ +} + bool ModuleBase_WidgetExprEditor::storeValueCustom() const { // A rare case when plugin was not loaded. @@ -270,6 +246,7 @@ bool ModuleBase_WidgetExprEditor::storeValueCustom() const return false; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); + QString aWidgetValue = myEditor->toPlainText(); aStringAttr->setValue(aWidgetValue.toStdString()); updateObject(myFeature); @@ -324,10 +301,9 @@ QList ModuleBase_WidgetExprEditor::getControls() const bool ModuleBase_WidgetExprEditor::processEnter() { - bool isModified = myEditor->isModified(); + bool isModified = getValueState() == ModifiedInPP; if (isModified) { emit valuesChanged(); - myEditor->clearModified(); myEditor->selectAll(); } return isModified;