mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Made translation between PdmUiItem and QModelIndex available in PdmUiTreeView
After considering the different options, I concluded that it is important to support the Qt way of doing things. If the App programmer wants to do things the Qt way, it should be possible.
This commit is contained in:
@@ -155,5 +155,21 @@ void PdmUiTreeView::setExpanded(const PdmUiItem* uiItem, bool doExpand) const
|
|||||||
m_treeViewEditor->setExpanded(uiItem, doExpand);
|
m_treeViewEditor->setExpanded(uiItem, doExpand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmUiItem* PdmUiTreeView::uiItemFromModelIndex(const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
return m_treeViewEditor->uiItemFromModelIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QModelIndex PdmUiTreeView::findModelIndex(const PdmUiItem* object) const
|
||||||
|
{
|
||||||
|
return m_treeViewEditor->findModelIndex(object);
|
||||||
|
}
|
||||||
|
|
||||||
} //End of namespace caf
|
} //End of namespace caf
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class QVBoxLayout;
|
|||||||
class QTreeView;
|
class QTreeView;
|
||||||
class QItemSelection;
|
class QItemSelection;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QModelIndex;
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@@ -73,6 +74,10 @@ public:
|
|||||||
void selectAsCurrentItem(PdmUiItem* uiItem);
|
void selectAsCurrentItem(PdmUiItem* uiItem);
|
||||||
void setExpanded(const PdmUiItem* uiItem, bool doExpand) const ;
|
void setExpanded(const PdmUiItem* uiItem, bool doExpand) const ;
|
||||||
|
|
||||||
|
PdmUiItem* uiItemFromModelIndex(const QModelIndex& index) const;
|
||||||
|
QModelIndex findModelIndex(const PdmUiItem* object) const;
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -274,5 +274,21 @@ void PdmUiTreeViewEditor::setExpanded(const PdmUiItem* uiItem, bool doExpand) co
|
|||||||
m_treeView->setExpanded(index, doExpand);
|
m_treeView->setExpanded(index, doExpand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmUiItem* PdmUiTreeViewEditor::uiItemFromModelIndex(const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
return m_treeViewModel->uiItemFromModelIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QModelIndex PdmUiTreeViewEditor::findModelIndex(const PdmUiItem* object) const
|
||||||
|
{
|
||||||
|
return m_treeViewModel->findModelIndex(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ public:
|
|||||||
void selectedUiItems(std::vector<PdmUiItem*>& objects);
|
void selectedUiItems(std::vector<PdmUiItem*>& objects);
|
||||||
void setExpanded(const PdmUiItem* uiItem, bool doExpand) const;
|
void setExpanded(const PdmUiItem* uiItem, bool doExpand) const;
|
||||||
|
|
||||||
|
PdmUiItem* uiItemFromModelIndex(const QModelIndex& index) const;
|
||||||
|
QModelIndex findModelIndex(const PdmUiItem* object) const;
|
||||||
|
|
||||||
QWidget* createWidget(QWidget* parent);
|
QWidget* createWidget(QWidget* parent);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
Reference in New Issue
Block a user