mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1912 AppFwk : Add support for setting of current item using attributes
This commit is contained in:
parent
1b96ab747d
commit
184e00c5aa
@ -147,17 +147,28 @@ QWidget* PdmUiTreeViewEditor::createWidget(QWidget* parent)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
// If we have a real object, get its editor attributes (Column headers for now)
|
||||
PdmUiTreeViewEditorAttribute editorAttributes;
|
||||
|
||||
if (this->pdmItemRoot() && dynamic_cast<PdmUiObjectHandle*>(this->pdmItemRoot()))
|
||||
{
|
||||
dynamic_cast<PdmUiObjectHandle*>(this->pdmItemRoot())->objectEditorAttribute(uiConfigName, &m_editorAttributes);
|
||||
PdmUiObjectHandle* uiObjectHandle = dynamic_cast<PdmUiObjectHandle*>(this->pdmItemRoot());
|
||||
if (uiObjectHandle)
|
||||
{
|
||||
uiObjectHandle->objectEditorAttribute(uiConfigName, &editorAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
m_treeViewModel->setColumnHeaders(m_editorAttributes.columnHeaders);
|
||||
m_treeViewModel->setColumnHeaders(editorAttributes.columnHeaders);
|
||||
m_treeViewModel->setUiConfigName(uiConfigName);
|
||||
m_treeViewModel->setPdmItemRoot(this->pdmItemRoot());
|
||||
|
||||
if (editorAttributes.currentObject)
|
||||
{
|
||||
PdmUiObjectHandle* uiObjectHandle = editorAttributes.currentObject->uiCapability();
|
||||
if (uiObjectHandle)
|
||||
{
|
||||
selectAsCurrentItem(uiObjectHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -72,10 +72,14 @@ class PdmUiTreeViewEditorAttribute : public PdmUiEditorAttribute
|
||||
public:
|
||||
PdmUiTreeViewEditorAttribute()
|
||||
{
|
||||
currentObject = nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
QStringList columnHeaders;
|
||||
|
||||
/// This object is set as current item in the tree view in configureAndUpdateUi()
|
||||
caf::PdmObjectHandle* currentObject;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -136,8 +140,6 @@ private:
|
||||
PdmUiTreeViewWidget* m_treeView;
|
||||
PdmUiTreeViewModel* m_treeViewModel;
|
||||
|
||||
PdmUiTreeViewEditorAttribute m_editorAttributes;
|
||||
|
||||
bool m_useDefaultContextMenu;
|
||||
bool m_updateSelectionManager;
|
||||
bool m_appendClassNameToUiItemText;
|
||||
|
Loading…
Reference in New Issue
Block a user