mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Renaming related to tree item root
p4#: 21355
This commit is contained in:
parent
d034717460
commit
a326fac204
@ -919,7 +919,7 @@ void RiuMainWindow::setPdmRoot(caf::PdmObject* pdmRoot)
|
||||
m_pdmRoot = pdmRoot;
|
||||
|
||||
caf::PdmUiTreeItem* treeItemRoot = caf::UiTreeItemBuilderPdm::buildViewItems(NULL, -1, m_pdmRoot);
|
||||
m_treeModelPdm->setRoot(treeItemRoot);
|
||||
m_treeModelPdm->setTreeItemRoot(treeItemRoot);
|
||||
|
||||
if (treeItemRoot && m_treeView->selectionModel())
|
||||
{
|
||||
|
@ -31,23 +31,23 @@ namespace caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
UiTreeModelPdm::UiTreeModelPdm(QObject* parent)
|
||||
{
|
||||
m_root = NULL;
|
||||
m_treeItemRoot = NULL;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void UiTreeModelPdm::setRoot(PdmUiTreeItem* root)
|
||||
void UiTreeModelPdm::setTreeItemRoot(PdmUiTreeItem* root)
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
if (m_root)
|
||||
if (m_treeItemRoot)
|
||||
{
|
||||
delete m_root;
|
||||
delete m_treeItemRoot;
|
||||
}
|
||||
|
||||
m_root = root;
|
||||
m_treeItemRoot = root;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ void UiTreeModelPdm::setRoot(PdmUiTreeItem* root)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QModelIndex UiTreeModelPdm::index(int row, int column, const QModelIndex &parentIndex /*= QModelIndex( ) */) const
|
||||
{
|
||||
if (!m_root)
|
||||
if (!m_treeItemRoot)
|
||||
return QModelIndex();
|
||||
|
||||
if (!hasIndex(row, column, parentIndex))
|
||||
@ -65,7 +65,7 @@ QModelIndex UiTreeModelPdm::index(int row, int column, const QModelIndex &parent
|
||||
PdmUiTreeItem* parentItem = NULL;
|
||||
|
||||
if (!parentIndex.isValid())
|
||||
parentItem = m_root;
|
||||
parentItem = m_treeItemRoot;
|
||||
else
|
||||
parentItem = UiTreeModelPdm::getTreeItemFromIndex(parentIndex);
|
||||
|
||||
@ -82,7 +82,7 @@ QModelIndex UiTreeModelPdm::index(int row, int column, const QModelIndex &parent
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QModelIndex UiTreeModelPdm::parent(const QModelIndex &childIndex) const
|
||||
{
|
||||
if (!m_root) return QModelIndex();
|
||||
if (!m_treeItemRoot) return QModelIndex();
|
||||
|
||||
if (!childIndex.isValid()) return QModelIndex();
|
||||
|
||||
@ -92,7 +92,7 @@ QModelIndex UiTreeModelPdm::parent(const QModelIndex &childIndex) const
|
||||
PdmUiTreeItem* parentItem = childItem->parent();
|
||||
if (!parentItem) return QModelIndex();
|
||||
|
||||
if (parentItem == m_root) return QModelIndex();
|
||||
if (parentItem == m_treeItemRoot) return QModelIndex();
|
||||
|
||||
return createIndex(parentItem->row(), 0, parentItem);
|
||||
}
|
||||
@ -102,7 +102,7 @@ QModelIndex UiTreeModelPdm::parent(const QModelIndex &childIndex) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int UiTreeModelPdm::rowCount(const QModelIndex &parentIndex /*= QModelIndex( ) */) const
|
||||
{
|
||||
if (!m_root)
|
||||
if (!m_treeItemRoot)
|
||||
return 0;
|
||||
|
||||
if (parentIndex.column() > 0)
|
||||
@ -110,7 +110,7 @@ int UiTreeModelPdm::rowCount(const QModelIndex &parentIndex /*= QModelIndex( ) *
|
||||
|
||||
PdmUiTreeItem* parentItem;
|
||||
if (!parentIndex.isValid())
|
||||
parentItem = m_root;
|
||||
parentItem = m_treeItemRoot;
|
||||
else
|
||||
parentItem = UiTreeModelPdm::getTreeItemFromIndex(parentIndex);
|
||||
|
||||
@ -122,7 +122,7 @@ int UiTreeModelPdm::rowCount(const QModelIndex &parentIndex /*= QModelIndex( ) *
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int UiTreeModelPdm::columnCount(const QModelIndex &parentIndex /*= QModelIndex( ) */) const
|
||||
{
|
||||
if (!m_root)
|
||||
if (!m_treeItemRoot)
|
||||
return 0;
|
||||
|
||||
if (parentIndex.isValid())
|
||||
@ -138,7 +138,7 @@ int UiTreeModelPdm::columnCount(const QModelIndex &parentIndex /*= QModelIndex(
|
||||
}
|
||||
}
|
||||
else
|
||||
return m_root->columnCount();
|
||||
return m_treeItemRoot->columnCount();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -146,7 +146,7 @@ int UiTreeModelPdm::columnCount(const QModelIndex &parentIndex /*= QModelIndex(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVariant UiTreeModelPdm::data(const QModelIndex &index, int role /*= Qt::DisplayRole */) const
|
||||
{
|
||||
if (!m_root)
|
||||
if (!m_treeItemRoot)
|
||||
return QVariant();
|
||||
|
||||
if (!index.isValid())
|
||||
@ -362,7 +362,7 @@ bool UiTreeModelPdm::removeRows_special(int position, int rows, const QModelInde
|
||||
}
|
||||
else
|
||||
{
|
||||
parentItem = m_root;
|
||||
parentItem = m_treeItemRoot;
|
||||
}
|
||||
|
||||
if (!parentItem) return true;
|
||||
@ -401,6 +401,14 @@ void UiTreeModelPdm::rebuildUiSubTree(PdmObject* root)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiTreeItem* UiTreeModelPdm::treeItemRoot()
|
||||
{
|
||||
return m_treeItemRoot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -43,7 +43,9 @@ class UiTreeModelPdm : public QAbstractItemModel
|
||||
public:
|
||||
UiTreeModelPdm(QObject* parent);
|
||||
|
||||
void setRoot(PdmUiTreeItem* root);
|
||||
void setTreeItemRoot(PdmUiTreeItem* root);
|
||||
PdmUiTreeItem* treeItemRoot();
|
||||
|
||||
void emitDataChanged(const QModelIndex& index);
|
||||
|
||||
static PdmUiTreeItem* getTreeItemFromIndex(const QModelIndex& index);
|
||||
@ -70,7 +72,7 @@ protected:
|
||||
QModelIndex getModelIndexFromPdmObjectRecursive(const QModelIndex& currentIndex, const PdmObject * object) const;
|
||||
|
||||
private:
|
||||
PdmUiTreeItem* m_root;
|
||||
PdmUiTreeItem* m_treeItemRoot;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user