MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / parent

Method parent

ElaWidgetToolsExample/ModelView/T_TreeViewModel.cpp:41–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41QModelIndex T_TreeViewModel::parent(const QModelIndex& child) const
42{
43 if (!child.isValid())
44 {
45 return QModelIndex();
46 }
47 T_TreeItem* childItem = static_cast<T_TreeItem*>(child.internalPointer());
48 T_TreeItem* parentItem = childItem->getParentItem();
49 if (parentItem == _rootItem)
50 {
51 return QModelIndex();
52 }
53 else if (parentItem == nullptr)
54 {
55 return QModelIndex();
56 }
57 return createIndex(parentItem->getRow(), 0, parentItem);
58}
59
60QModelIndex T_TreeViewModel::index(int row, int column, const QModelIndex& parent) const
61{

Callers 1

foreachFunction · 0.45

Calls 1

getRowMethod · 0.45

Tested by

no test coverage detected