mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Adjust auto plot settings
* Adjust the max value for summary curves to get more space on top of plot * Compute axis range before computing auto plot settings * Use axis object name as key when computing aggregated min/max * Guard infinite recursion for enableAutoValue()
This commit is contained in:
@@ -140,11 +140,7 @@ void PdmUiFieldHandle::setAutoValue( const QVariant& autoValue, bool notifyField
|
||||
{
|
||||
m_autoValue = autoValue;
|
||||
|
||||
if ( m_useAutoValue && m_autoValue.isValid() )
|
||||
{
|
||||
setValueFromUiEditor( m_autoValue, notifyFieldChanged );
|
||||
updateConnectedEditors();
|
||||
}
|
||||
applyAutoValueAndUpdateEditors( notifyFieldChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -158,15 +154,11 @@ QVariant PdmUiFieldHandle::autoValue() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiFieldHandle::enableAutoValue( bool enable )
|
||||
void PdmUiFieldHandle::enableAutoValue( bool enable, bool notifyFieldChanged )
|
||||
{
|
||||
m_useAutoValue = enable;
|
||||
|
||||
if ( m_useAutoValue && m_autoValue.isValid() )
|
||||
{
|
||||
setValueFromUiEditor( m_autoValue, true );
|
||||
updateConnectedEditors();
|
||||
}
|
||||
applyAutoValueAndUpdateEditors( notifyFieldChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -228,7 +220,11 @@ void PdmUiFieldHandle::setAttributes( const std::vector<std::pair<QString, QStri
|
||||
{
|
||||
if ( valueString == "TRUE" )
|
||||
{
|
||||
enableAutoValue( true );
|
||||
// If notifyFieldChanged equals true, recursion will happen. Triggered by
|
||||
// RimSummaryPlot::copyMatchingAxisPropertiesFromOther(), where data from one object is copied and set
|
||||
// in another object using readObjectFromXmlString()
|
||||
bool notifyFieldChanged = false;
|
||||
enableAutoValue( true, notifyFieldChanged );
|
||||
}
|
||||
}
|
||||
else if ( key == "autoValueSupported" )
|
||||
@@ -257,6 +253,18 @@ bool PdmUiFieldHandle::isQVariantDataEqual( const QVariant& oldUiBasedQVariant,
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiFieldHandle::applyAutoValueAndUpdateEditors( bool notifyFieldChanged )
|
||||
{
|
||||
if ( m_useAutoValue && m_autoValue.isValid() )
|
||||
{
|
||||
setValueFromUiEditor( m_autoValue, notifyFieldChanged );
|
||||
updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Implementation of uiCapability() defined in cafPdmFieldHandle.h
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
void enableAndSetAutoValue( const QVariant& autoValue );
|
||||
void setAutoValue( const QVariant& autoValue, bool notifyFieldChanged = true );
|
||||
QVariant autoValue() const;
|
||||
void enableAutoValue( bool enable );
|
||||
void enableAutoValue( bool enable, bool notifyFieldChanged = true );
|
||||
bool isAutoValueEnabled() const;
|
||||
void enableAutoValueSupport( bool enable );
|
||||
bool isAutoValueSupported() const;
|
||||
@@ -46,6 +46,8 @@ private:
|
||||
// custom types.
|
||||
virtual bool isQVariantDataEqual( const QVariant& oldUiBasedQVariant, const QVariant& newUiBasedQVariant ) const;
|
||||
|
||||
void applyAutoValueAndUpdateEditors( bool notifyFieldChanged );
|
||||
|
||||
private:
|
||||
PdmFieldHandle* m_owner;
|
||||
bool m_isAutoAddingOptionFromValue;
|
||||
|
||||
Reference in New Issue
Block a user