mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#964 Improve code robustness in defineEditorAttribute
This commit is contained in:
parent
68cb4ab54f
commit
63cd817b85
@ -113,7 +113,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
|
||||
|
||||
if (field == &scriptDirectories)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
@ -129,7 +129,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
|
||||
field == &showLasCurveWithoutTvdWarning ||
|
||||
field == &autoCreatePlotsOnImport)
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_useNativeCheckBoxLabel = true;
|
||||
|
@ -51,7 +51,7 @@ void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
{
|
||||
if (field == &applicationWorkingFolder || field == ®ressionTestFolder)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
|
@ -121,7 +121,7 @@ void RicExportToLasFileResampleUi::defineEditorAttribute(const caf::PdmFieldHand
|
||||
{
|
||||
if (field == &exportFolder)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
@ -130,7 +130,7 @@ void RicExportToLasFileResampleUi::defineEditorAttribute(const caf::PdmFieldHand
|
||||
|
||||
if (field == &exportTvdrkb || field == &activateResample)
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_useNativeCheckBoxLabel = true;
|
||||
|
@ -52,7 +52,7 @@ void RifReaderSettings::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
field == &importAdvancedMswData ||
|
||||
field == &importNNCs)
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_useNativeCheckBoxLabel = true;
|
||||
|
@ -43,7 +43,7 @@ void RimBinaryExportSettings::defineEditorAttribute(const caf::PdmFieldHandle* f
|
||||
{
|
||||
if (field == &fileName)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectSaveFileName = true;
|
||||
|
@ -171,7 +171,7 @@ RimCellRangeFilterCollection* RimCellRangeFilter::parentContainer()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
||||
{
|
||||
caf::PdmUiSliderEditorAttribute* myAttr = static_cast<caf::PdmUiSliderEditorAttribute*>(attribute);
|
||||
caf::PdmUiSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiSliderEditorAttribute*>(attribute);
|
||||
if (!myAttr || !parentContainer())
|
||||
{
|
||||
return;
|
||||
|
@ -613,13 +613,19 @@ void RimEclipseStatisticsCase::defineEditorAttribute(const caf::PdmFieldHandle*
|
||||
if (&m_selectionSummary == field)
|
||||
{
|
||||
caf::PdmUiTextEditorAttribute* textEditAttrib = dynamic_cast<caf::PdmUiTextEditorAttribute*> (attribute);
|
||||
textEditAttrib->textMode = caf::PdmUiTextEditorAttribute::HTML;
|
||||
if (textEditAttrib)
|
||||
{
|
||||
textEditAttrib->textMode = caf::PdmUiTextEditorAttribute::HTML;
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_calculateEditCommand == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
attrib->m_buttonText = hasComputedStatistics() ? "Edit (Will DELETE current results)": "Compute";
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = hasComputedStatistics() ? "Edit (Will DELETE current results)": "Compute";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ void RimExportInputSettings::defineEditorAttribute(const caf::PdmFieldHandle* fi
|
||||
{
|
||||
if (field == &fileName)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectSaveFileName = true;
|
||||
|
@ -553,13 +553,16 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
|
||||
if (inputPolyLineFromViewerEnabled)
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Stop picking points";
|
||||
}
|
||||
else
|
||||
{
|
||||
attrib->m_buttonText = "Start picking points";
|
||||
if (inputPolyLineFromViewerEnabled)
|
||||
{
|
||||
attrib->m_buttonText = "Stop picking points";
|
||||
}
|
||||
else
|
||||
{
|
||||
attrib->m_buttonText = "Start picking points";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (field == &m_userPolyline)
|
||||
@ -574,13 +577,16 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
|
||||
if (inputExtrusionPointsFromViewerEnabled)
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Stop picking points";
|
||||
}
|
||||
else
|
||||
{
|
||||
attrib->m_buttonText = "Start picking points";
|
||||
if (inputExtrusionPointsFromViewerEnabled)
|
||||
{
|
||||
attrib->m_buttonText = "Stop picking points";
|
||||
}
|
||||
else
|
||||
{
|
||||
attrib->m_buttonText = "Start picking points";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (field == &m_customExtrusionPoints)
|
||||
|
@ -404,14 +404,18 @@ void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
|
||||
if (m_show3DManipulator)
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Hide 3D manipulator";
|
||||
}
|
||||
else
|
||||
{
|
||||
attrib->m_buttonText = "Show 3D manipulator";
|
||||
if (m_show3DManipulator)
|
||||
{
|
||||
attrib->m_buttonText = "Hide 3D manipulator";
|
||||
}
|
||||
else
|
||||
{
|
||||
attrib->m_buttonText = "Show 3D manipulator";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,10 @@ void RimScriptCollection::defineEditorAttribute(const caf::PdmFieldHandle* field
|
||||
{
|
||||
if (field == &directory)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
myAttr->m_selectDirectory = true;
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +423,10 @@ void RimSummaryCurveFilter::defineEditorAttribute(const caf::PdmFieldHandle* fie
|
||||
if(&m_applyButtonField == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
attrib->m_buttonText = "Apply";
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Apply";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -984,7 +984,7 @@ void RimSummaryPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
|
||||
{
|
||||
if (field == &m_showLegend || field == &m_showPlotTitle)
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_useNativeCheckBoxLabel = true;
|
||||
|
Loading…
Reference in New Issue
Block a user