diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp index d398f88cef..98f9e40430 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp @@ -32,8 +32,10 @@ #include "cvfAssert.h" +#include "cafPdmUiLineEditor.h" #include "cafPdmUiTreeOrdering.h" +#include #include //-------------------------------------------------------------------------------------------------- @@ -79,6 +81,7 @@ RimWellPathCompletions::RimWellPathCompletions() m_fractureCollection.uiCapability()->setUiHidden(true); CAF_PDM_InitField(&m_wellNameForExport, "WellNameForExport", QString(), "Well Name for Completion Export", "", "", ""); + m_wellNameForExport.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName()); CAF_PDM_InitField(&m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name for Completion Export", "", "", ""); @@ -282,6 +285,23 @@ void RimWellPathCompletions::fieldChangedByUi(const caf::PdmFieldHandle* changed } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathCompletions::defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute) +{ + caf::PdmUiLineEditorAttribute* lineEditorAttr = dynamic_cast(attribute); + if (field == &m_wellNameForExport && lineEditorAttr) + { + QRegExp rx("[\\w\\-\\_]{1,8}"); + QRegExpValidator* validator = new QRegExpValidator(nullptr); + validator->setRegExp(rx); + lineEditorAttr->validator = validator; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h index 4ccc47067e..0d4c5ca92a 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h @@ -61,6 +61,7 @@ public: protected: void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; private: QString formatStringForExport(const QString& text, const QString& defaultText = "") const;