mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1920 Curve creator. Adjust target plot combobox width to contents
This commit is contained in:
parent
70ede18dc1
commit
f4148dfe7a
@ -51,6 +51,7 @@
|
||||
#include "RimOilField.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCurveAutoName.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicSummaryCurveCreator, "RicSummaryCurveCreator");
|
||||
@ -179,6 +180,7 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
||||
CAF_PDM_InitFieldNoDefault(&m_groupAppearanceType, "GroupAppearanceType", "Group", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_regionAppearanceType, "RegionAppearanceType", "Region", "", "", "");
|
||||
|
||||
//m_targetPlot
|
||||
m_previewPlot = new RimSummaryPlot();
|
||||
|
||||
for (const auto& itemTypes : m_identifierFieldsMap)
|
||||
@ -1048,6 +1050,14 @@ void RicSummaryCurveCreator::defineEditorAttribute(const caf::PdmFieldHandle* fi
|
||||
attrib->showToggleAllCheckbox = false;
|
||||
}
|
||||
}
|
||||
else if (&m_targetPlot == field)
|
||||
{
|
||||
caf::PdmUiComboBoxEditorAttribute* attrib = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->adjustWidthToContents = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -86,6 +86,20 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
m_comboBox->addItem(field()->uiValue().toString());
|
||||
m_comboBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
// Handle attributes
|
||||
PdmUiComboBoxEditorAttribute attributes;
|
||||
caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject());
|
||||
if (uiObject)
|
||||
{
|
||||
uiObject->editorAttribute(field()->fieldHandle(), uiConfigName, &attributes);
|
||||
}
|
||||
|
||||
if (attributes.adjustWidthToContents)
|
||||
{
|
||||
m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
}
|
||||
|
||||
m_comboBox->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,13 @@ namespace caf
|
||||
|
||||
class PdmUiComboBoxEditorAttribute : public PdmUiEditorAttribute
|
||||
{
|
||||
public:
|
||||
bool adjustWidthToContents;
|
||||
|
||||
PdmUiComboBoxEditorAttribute()
|
||||
{
|
||||
adjustWidthToContents = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user