mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Removed obsolete code and cleaned up interface
p4#: 22316
This commit is contained in:
parent
5f09fd0fa9
commit
f9a40ad7ca
@ -43,7 +43,12 @@ PdmUiTreeView::PdmUiTreeView(QWidget* parent, Qt::WindowFlags f)
|
|||||||
|
|
||||||
setLayout(m_layout);
|
setLayout(m_layout);
|
||||||
|
|
||||||
m_treeViewEditor = NULL;
|
m_treeViewEditor = new PdmUiTreeViewEditor();
|
||||||
|
|
||||||
|
QWidget * widget = m_treeViewEditor->getOrCreateWidget(this);
|
||||||
|
|
||||||
|
this->m_layout->insertWidget(0, widget);
|
||||||
|
this->m_layout->setStretchFactor(widget, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -64,81 +69,17 @@ void PdmUiTreeView::setUiConfigurationName(QString uiConfigName)
|
|||||||
{
|
{
|
||||||
m_uiConfigName = uiConfigName;
|
m_uiConfigName = uiConfigName;
|
||||||
|
|
||||||
if (m_treeViewEditor)
|
m_treeViewEditor->updateUi(m_uiConfigName);
|
||||||
{
|
|
||||||
PdmObject* object = m_treeViewEditor->pdmObject();
|
|
||||||
delete m_treeViewEditor;
|
|
||||||
m_treeViewEditor = NULL;
|
|
||||||
this->showTree(object);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTreeView::showTree(caf::PdmObject* object)
|
void PdmUiTreeView::setPdmObject(caf::PdmObject* object)
|
||||||
{
|
{
|
||||||
// Find specialized object view handle
|
|
||||||
|
|
||||||
// If the current ObjectView has the same type as the one to view, reuse, with Widget etc.
|
|
||||||
|
|
||||||
bool rebuildWidget = false;
|
|
||||||
|
|
||||||
if (!m_treeViewEditor) rebuildWidget = true;
|
|
||||||
|
|
||||||
if (m_treeViewEditor && m_treeViewEditor->pdmObject())
|
|
||||||
{
|
|
||||||
if (object)
|
|
||||||
{
|
|
||||||
if (m_treeViewEditor->pdmObject()->uiEditorTypeName(m_uiConfigName) != object->uiEditorTypeName(m_uiConfigName))
|
|
||||||
{
|
|
||||||
rebuildWidget = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebuildWidget)
|
|
||||||
{
|
|
||||||
// Remove Widget from layout
|
|
||||||
if (m_treeViewEditor)
|
|
||||||
{
|
|
||||||
layout()->removeWidget(m_treeViewEditor->widget());
|
|
||||||
delete m_treeViewEditor;
|
|
||||||
m_treeViewEditor = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//m_currentObjectView = PdmObjViewFactory::instance()->create(object->editorType(m_uiConfigName));
|
|
||||||
if (!m_treeViewEditor)
|
|
||||||
{
|
|
||||||
m_treeViewEditor = new PdmUiTreeViewEditor();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create widget to handle this
|
|
||||||
QWidget * widget = NULL;
|
|
||||||
widget = m_treeViewEditor->getOrCreateWidget(this);
|
|
||||||
|
|
||||||
assert(widget);
|
|
||||||
|
|
||||||
this->m_layout->insertWidget(0, widget);
|
|
||||||
|
|
||||||
this->m_layout->setStretchFactor(widget, 10);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
m_treeViewEditor->setPdmObject(object);
|
m_treeViewEditor->setPdmObject(object);
|
||||||
m_treeViewEditor->updateUi(m_uiConfigName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
caf::PdmObject* PdmUiTreeView::currentObject()
|
|
||||||
{
|
|
||||||
if (!m_treeViewEditor) return NULL;
|
|
||||||
return m_treeViewEditor->pdmObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} //End of namespace caf
|
} //End of namespace caf
|
||||||
|
|
||||||
|
@ -41,9 +41,7 @@ public:
|
|||||||
~PdmUiTreeView();
|
~PdmUiTreeView();
|
||||||
|
|
||||||
void setUiConfigurationName(QString uiConfigName);
|
void setUiConfigurationName(QString uiConfigName);
|
||||||
caf::PdmObject* currentObject();
|
void setPdmObject(caf::PdmObject* object);
|
||||||
public slots:
|
|
||||||
void showTree(caf::PdmObject* object);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PdmUiTreeViewEditor* m_treeViewEditor;
|
PdmUiTreeViewEditor* m_treeViewEditor;
|
||||||
|
Loading…
Reference in New Issue
Block a user