mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
Caf: Added asserts to make it clearer that "useOptionsOnly" == false is unsupported yet.
This commit is contained in:
parent
5df94a1e18
commit
2ccabc4589
@ -77,12 +77,10 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
|
|||||||
{
|
{
|
||||||
m_comboBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
m_comboBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||||
|
|
||||||
// Demo code for attribute retreival when becoming relevant
|
bool fromMenuOnly = true;
|
||||||
// PdmUiComboBoxEditorAttribute attributes;
|
|
||||||
// field()->ownerObject()->editorAttribute(field(), uiConfigName, &attributes);
|
|
||||||
|
|
||||||
bool fromMenuOnly = false;
|
|
||||||
QList<PdmOptionItemInfo> options = field()->valueOptions(&fromMenuOnly);
|
QList<PdmOptionItemInfo> options = field()->valueOptions(&fromMenuOnly);
|
||||||
|
assert(fromMenuOnly); // Not supported
|
||||||
|
|
||||||
m_comboBox->blockSignals(true);
|
m_comboBox->blockSignals(true);
|
||||||
m_comboBox->clear();
|
m_comboBox->clear();
|
||||||
if (!options.isEmpty())
|
if (!options.isEmpty())
|
||||||
|
@ -435,6 +435,7 @@ caf::PdmUiFieldEditorHandle* PdmUiFieldEditorHelper::fieldEditorForField(PdmUiFi
|
|||||||
|
|
||||||
bool useOptionsOnly = true;
|
bool useOptionsOnly = true;
|
||||||
QList<PdmOptionItemInfo> options = field->valueOptions(&useOptionsOnly);
|
QList<PdmOptionItemInfo> options = field->valueOptions(&useOptionsOnly);
|
||||||
|
assert(fromMenuOnly); // Not supported
|
||||||
|
|
||||||
if (!options.empty())
|
if (!options.empty())
|
||||||
{
|
{
|
||||||
|
@ -215,8 +215,10 @@ void PdmUiLineEditor::configureAndUpdateUi(const QString& uiConfigName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool fromMenuOnly = false;
|
bool fromMenuOnly = true;
|
||||||
QList<PdmOptionItemInfo> enumNames = field()->valueOptions(&fromMenuOnly);
|
QList<PdmOptionItemInfo> enumNames = field()->valueOptions(&fromMenuOnly);
|
||||||
|
assert(fromMenuOnly); // Not supported
|
||||||
|
|
||||||
if (!enumNames.isEmpty() && fromMenuOnly == true)
|
if (!enumNames.isEmpty() && fromMenuOnly == true)
|
||||||
{
|
{
|
||||||
int enumValue = field()->uiValue().toInt();
|
int enumValue = field()->uiValue().toInt();
|
||||||
|
@ -99,7 +99,7 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiListEditor);
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
PdmUiListEditor::PdmUiListEditor(): m_optionsOnly(false)
|
PdmUiListEditor::PdmUiListEditor(): m_optionsOnly(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,6 +219,7 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
|
|||||||
QList<PdmOptionItemInfo> options;
|
QList<PdmOptionItemInfo> options;
|
||||||
bool useOptionsOnly = true;
|
bool useOptionsOnly = true;
|
||||||
options = uiFieldHandle->valueOptions(&useOptionsOnly);
|
options = uiFieldHandle->valueOptions(&useOptionsOnly);
|
||||||
|
assert(useOptionsOnly); // Not supported
|
||||||
|
|
||||||
for (QVariant v : valuesSelectedInField)
|
for (QVariant v : valuesSelectedInField)
|
||||||
{
|
{
|
||||||
@ -238,8 +239,10 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
|
|||||||
return displayText;
|
return displayText;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool useOptionsOnly = false;
|
bool useOptionsOnly = true;
|
||||||
QList<PdmOptionItemInfo> valueOptions = uiFieldHandle->valueOptions(&useOptionsOnly);
|
QList<PdmOptionItemInfo> valueOptions = uiFieldHandle->valueOptions(&useOptionsOnly);
|
||||||
|
assert(useOptionsOnly); // Not supported
|
||||||
|
|
||||||
if (!valueOptions.isEmpty())
|
if (!valueOptions.isEmpty())
|
||||||
{
|
{
|
||||||
int listIndex = uiFieldHandle->uiValue().toInt();
|
int listIndex = uiFieldHandle->uiValue().toInt();
|
||||||
|
Loading…
Reference in New Issue
Block a user