// Author: Natalia ERMOLAEVA
#include <ModuleBase_WidgetEditor.h>
+#include <ModuleBase_DoubleSpinBox.h>
+#include <ModuleBase_Tools.h>
#include <Config_Keywords.h>
#include <Config_WidgetAPI.h>
#include <Events_Loop.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
#include <QTimer>
#include <QDialog>
#include <QLayout>
-#include <QDoubleSpinBox>
ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent,
- const Config_WidgetAPI* theData)
-: ModuleBase_WidgetDoubleValue(theParent, theData)
+ const Config_WidgetAPI* theData,
+ const std::string& theParentId)
+ : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId)
{
}
-ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute)
-: ModuleBase_WidgetDoubleValue(theParent, 0)
-{
- setAttributeID(theAttribute);
-}
-
ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor()
{
}
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));
QObject::connect(aEditor, SIGNAL(returnPressed()), &aDlg, SLOT(accept()));
aLay->addWidget(aEditor);
return aValue;
}
-void ModuleBase_WidgetEditor::focusTo()
+bool ModuleBase_WidgetEditor::focusTo()
{
double aValue = mySpinBox->value();
bool isDone;
}
emit valuesChanged();
emit focusOutWidget(this);
+
+ return false;
}
-void ModuleBase_WidgetEditor::editFeatureValue(FeaturePtr theFeature, const std::string theAttribute)
+void ModuleBase_WidgetEditor::editFeatureValue(FeaturePtr theFeature,
+ const std::string theAttribute)
{
DataPtr aData = theFeature->data();
AttributeDoublePtr aRef = aData->real(theAttribute);