From b33f086ad6bc7e610d37631b003c9d97c59ba935 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 4 Mar 2015 14:12:54 +0300 Subject: [PATCH] Selection of the text in the editor control --- src/ModuleBase/ModuleBase_WidgetEditor.cpp | 1 + src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp | 3 ++- src/PartSet/PartSet_WidgetPoint2d.cpp | 2 ++ src/SketchPlugin/SketchPlugin_Feature.h | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.cpp b/src/ModuleBase/ModuleBase_WidgetEditor.cpp index 07c59651d..8c3b74bdf 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetEditor.cpp @@ -47,6 +47,7 @@ double editedValue(double theValue, bool& isDone) ModuleBase_Tools::zeroMargins(aLay); QLineEdit* aEditor = new QLineEdit(QString::number(theValue), &aDlg); + aEditor->selectAll(); aEditor->setValidator(new QDoubleValidator(aEditor)); QObject::connect(aEditor, SIGNAL(returnPressed()), &aDlg, SLOT(accept())); aLay->addWidget(aEditor); diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 34fc4ec41..5514a06e3 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -447,7 +447,8 @@ void ModuleBase_WidgetShapeSelector::selectionFilters(SelectMgr_ListOfFilter& th if (!myObjectTypes.isEmpty() && myObjTypeFilter.IsNull()) { myObjTypeFilter = new ModuleBase_ObjectTypesFilter(myWorkshop, myObjectTypes); } - theFilters.Append(myObjTypeFilter); + if (!myObjTypeFilter.IsNull()) + theFilters.Append(myObjTypeFilter); // apply filters loaded from the XML definition of the widget ModuleBase_FilterFactory* aFactory = myWorkshop->selectionFilters(); diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 4915eec35..d011bb5d2 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -54,6 +54,8 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, const std::string& theParentId) : ModuleBase_ModelWidget(theParent, theData, theParentId) { + // the control should accept the focus, so the boolen flag is corrected to be true + myIsObligatory = true; //myOptionParam = theData->getProperty(PREVIOUS_FEATURE_PARAM); QString aPageName = QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME)); myGroupBox = new QGroupBox(aPageName, theParent); diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index 607f66725..4be01f0a6 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -88,7 +88,9 @@ class SketchPlugin_Feature : public ModelAPI_Feature, public GeomAPI_ICustomPrs if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/) return; - bool isConstruction = data()->boolean(SketchPlugin_Feature::CONSTRUCTION_ID())->value(); + std::shared_ptr aConstructionAttr = + data()->boolean(SketchPlugin_Feature::CONSTRUCTION_ID()); + bool isConstruction = aConstructionAttr.get() != NULL && aConstructionAttr->value(); if (aShapeType == 6) { // if this is an edge if (isConstruction) { thePrs->setWidth(1); -- 2.39.2