#1895 Curve Creator : Use PdmFieldHandle instead of PdmUiFieldHandle

This commit is contained in:
Magne Sjaastad committed 2017-09-20 10:43:19 +02:00
1 parent 86fa56aedc
commit b3b0a7ba9b
3 files changed
+12 -8

No files matched your search

@@ -330,7 +330,7 @@ protected:
caf::PdmUiTreeSelectionEditorAttribute* attr = dynamic_cast<caf::PdmUiTreeSelectionEditorAttribute*>(attribute);
if (attr)
{
attr->fieldToReceiveCurrentFieldValue = m_highlightedEnum.uiCapability();
attr->fieldToReceiveCurrentFieldValue = &m_highlightedEnum;
}
}
}
@@ -407,13 +407,17 @@ void PdmUiTreeSelectionEditor::slotTextFilterChanged()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiTreeSelectionEditor::slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous)
void PdmUiTreeSelectionEditor::slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous)
{
if (m_attributes.fieldToReceiveCurrentFieldValue)
if (m_attributes.fieldToReceiveCurrentItemValue)
{
QVariant v = m_proxyModel->data(current, PdmUiTreeSelectionQModel::optionItemValueRole());
PdmUiFieldHandle* uiFieldHandle = m_attributes.fieldToReceiveCurrentItemValue->uiCapability();
if (uiFieldHandle)
{
QVariant v = m_proxyModel->data(current, PdmUiTreeSelectionQModel::optionItemValueRole());
PdmUiCommandSystemProxy::instance()->setUiValueToField(m_attributes.fieldToReceiveCurrentFieldValue, v);
PdmUiCommandSystemProxy::instance()->setUiValueToField(uiFieldHandle, v);
}
}
}
@@ -66,7 +66,7 @@ public:
/// This is useful when displaying a list of appEnums, and a dependent view is displaying content based on
/// the current item in the tree view
/// Make sure the type of the receiving field is of the same type as the field used in PdmUiTreeSelectionEditor
caf::PdmUiFieldHandle* fieldToReceiveCurrentFieldValue;
caf::PdmFieldHandle* fieldToReceiveCurrentItemValue;
public:
PdmUiTreeSelectionEditorAttribute()
@@ -74,7 +74,7 @@ public:
showTextFilter = true;
showToggleAllCheckbox = true;
fieldToReceiveCurrentFieldValue = nullptr;
fieldToReceiveCurrentItemValue = nullptr;
}
};
@@ -107,7 +107,7 @@ private slots:
void slotTextFilterChanged();
void slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
void slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
private:
void checkAllItems();