X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetEditor.cpp;h=7f77acd5a97ac1064fdfd533699a7e85dd71b4ad;hb=8b3ac2b938bd55064a6f260ca7ec9c9a84cd977e;hp=b42e8401797c260b8450242e57db5a550f19b9a7;hpb=8dc74f82810d5f597b78633b457efb0ef4f89f9f;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.cpp b/src/ModuleBase/ModuleBase_WidgetEditor.cpp index b42e84017..7f77acd5a 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetEditor.cpp @@ -1,8 +1,12 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModuleBase_WidgetEditor.cpp // Created: 25 Apr 2014 // Author: Natalia ERMOLAEVA #include +#include +#include #include #include @@ -22,7 +26,7 @@ #include #include #include -#include +#include ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData, @@ -31,13 +35,6 @@ ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, { } -ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, - const std::string& theAttribute) - : ModuleBase_WidgetDoubleValue(theParent, 0, "") -{ - setAttributeID(theAttribute); -} - ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() { } @@ -47,7 +44,7 @@ double editedValue(double theValue, bool& isDone) QDialog aDlg; aDlg.setWindowFlags(Qt::FramelessWindowHint); QHBoxLayout* aLay = new QHBoxLayout(&aDlg); - aLay->setContentsMargins(0, 0, 0, 0); + ModuleBase_Tools::zeroMargins(aLay); QLineEdit* aEditor = new QLineEdit(QString::number(theValue), &aDlg); aEditor->setValidator(new QDoubleValidator(aEditor)); @@ -66,6 +63,16 @@ double editedValue(double theValue, bool& isDone) bool ModuleBase_WidgetEditor::focusTo() { + // We can not launch here modal process for value editing because + // it can be called on other focusOutWidget event and will block it + QTimer::singleShot(1, this, SLOT(showPopupEditor())); + return true; +} + +void ModuleBase_WidgetEditor::showPopupEditor() +{ + // White while all events will be processed + QApplication::processEvents(); double aValue = mySpinBox->value(); bool isDone; aValue = editedValue(aValue, isDone); @@ -77,8 +84,6 @@ bool ModuleBase_WidgetEditor::focusTo() } emit valuesChanged(); emit focusOutWidget(this); - - return false; } void ModuleBase_WidgetEditor::editFeatureValue(FeaturePtr theFeature,