mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4722 Summary Plot Editor : Update current item in tree view
Make sure the current selected item in the tree view is updated with the value in the underlying field.
This commit is contained in:
parent
4d82a65d8b
commit
cba51615d8
@ -354,6 +354,26 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
m_treeView->setRootIsDecorated(m_model->hasGrandChildren());
|
||||
|
||||
m_model->resetUiValueCache();
|
||||
|
||||
if (m_attributes.fieldToReceiveCurrentItemValue)
|
||||
{
|
||||
PdmUiFieldHandle* uiFieldHandle = m_attributes.fieldToReceiveCurrentItemValue->uiCapability();
|
||||
if (uiFieldHandle)
|
||||
{
|
||||
QModelIndexList indices = allVisibleSourceModelIndices();
|
||||
QVariant currentItemValue = uiFieldHandle->uiValue();
|
||||
|
||||
for (const auto& mi : indices)
|
||||
{
|
||||
QVariant itemValue = m_model->data(mi, PdmUiTreeSelectionQModel::optionItemValueRole());
|
||||
if (currentItemValue == itemValue)
|
||||
{
|
||||
QModelIndex treeViewIndex = m_proxyModel->mapFromSource(mi);
|
||||
m_treeView->setCurrentIndex(treeViewIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user