mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
Removed a call to uiValue() that was not preceeded with valueOptions().
Understood that this is an inherent problem with those two methods, and made a comment on that.
This commit is contained in:
parent
f65559af38
commit
296dac48d3
@ -102,6 +102,12 @@ void caf::PdmFieldUiCap<FieldType>::setValueFromUiEditor(const QVariant& uiValue
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Extracts a QVariant representation of the data in the field to be used in the UI.
|
||||
///
|
||||
/// Note : You have to call valueOptions() before this method to make sure that the m_optionEntryCache is updated and valid !!!
|
||||
/// We should find a way to enforce this, but JJS and MSJ could not think of a way to catch the situation
|
||||
/// that would always be valid. Could invalidate cache when all editors are removed. That would help.
|
||||
/// It is not considered to be healthy to always call valueOptions() from this method either -> double calls to valueOptions()
|
||||
/// The solution might actually be to merge the two ino one method, making uiValues and valueOptions directly connected.
|
||||
///
|
||||
/// Note : For fields with a none-empty m_optionEntryCache list, the returned QVariant contains the
|
||||
/// _indexes_ to the selected options rather than the actual values, if they can be found.
|
||||
///
|
||||
@ -122,7 +128,10 @@ QVariant caf::PdmFieldUiCap<FieldType>::uiValue() const
|
||||
{
|
||||
if (isAutoAddingOptionFromValue() && indexesToFoundOptions.size() != static_cast<size_t>(uiBasedQVariant.toList().size()))
|
||||
{
|
||||
assert(false); // Did not find all the field values among the options available, even though we should. The "core" data type in the field is probably not supported by QVariant::toString()
|
||||
assert(false); // Did not find all the field values among the options available, even though we should.
|
||||
// Reasons might be:
|
||||
// The "core" data type in the field is probably not supported by QVariant::toString()
|
||||
// You forgot to call valueOptions() before the call to uiValue().
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -272,7 +272,7 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
|
||||
|
||||
// Handle a single value field with valueOptions: Make a combobox
|
||||
|
||||
if (field->uiValue().type() != QVariant::List)
|
||||
if (field->toUiBasedQVariant().type() != QVariant::List)
|
||||
{
|
||||
bool useOptionsOnly = true;
|
||||
QList<PdmOptionItemInfo> options = field->valueOptions( &useOptionsOnly);
|
||||
|
Loading…
Reference in New Issue
Block a user