From cde05458f2f958eb3793299ff54c1f5b7fbc4003 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 20 Sep 2023 12:47:35 +0200 Subject: [PATCH] Reorder curve calculator to use more of available screen space --- .../ProjectDataModel/RimSummaryCalculation.cpp | 18 ++++++++---------- .../ProjectDataModel/RimSummaryCalculation.h | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 2d89a6bf2b..facb9e1bc8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -62,6 +62,7 @@ RimSummaryCalculation::RimSummaryCalculation() CAF_PDM_InitObject( "RimSummaryCalculation", ":/octave.png", "Calculation", "" ); CAF_PDM_InitField( &m_distributeToOtherItems, "DistributeToOtherItems", true, "Distribute to other items (wells, groups, ..)" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_distributeToOtherItems ); } //-------------------------------------------------------------------------------------------------- @@ -200,18 +201,15 @@ bool RimSummaryCalculation::detectCyclicCalculation( int id, std::set& ids //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +void RimSummaryCalculation::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - RimUserDefinedCalculation::defineEditorAttribute( field, uiConfigName, attribute ); + RimUserDefinedCalculation::defineUiOrdering( uiConfigName, uiOrdering ); - if ( field == &m_distributeToOtherItems ) - { - auto myAttr = dynamic_cast( attribute ); - if ( myAttr ) - { - myAttr->setWordWrap( true ); - } - } + // Adjust the layout to avoid a lot of unused white space in dialog + m_description.uiCapability()->setUiHidden( true ); + m_expression.uiCapability()->setUiName( "Expression" ); + m_expression.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); + m_unit.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h index d4d55a7fff..3237eb3617 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h @@ -87,7 +87,7 @@ protected: bool checkVariables() const; bool detectCyclicCalculation( int id, std::set& ids ) const; - void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; private: caf::PdmField m_distributeToOtherItems;