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

Method index

ElaWidgetToolsExample/ModelView/T_TreeViewModel.cpp:60–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60QModelIndex T_TreeViewModel::index(int row, int column, const QModelIndex& parent) const
61{
62 if (!hasIndex(row, column, parent))
63 {
64 return QModelIndex();
65 }
66 T_TreeItem* parentItem;
67 if (!parent.isValid())
68 {
69 parentItem = _rootItem;
70 }
71 else
72 {
73 parentItem = static_cast<T_TreeItem*>(parent.internalPointer());
74 }
75 T_TreeItem* childItem = nullptr;
76 if (parentItem->getChildrenItems().count() > row)
77 {
78 childItem = parentItem->getChildrenItems().at(row);
79 }
80 if (childItem)
81 {
82 return createIndex(row, column, childItem);
83 }
84 return QModelIndex();
85}
86
87int T_TreeViewModel::rowCount(const QModelIndex& parent) const
88{

Callers 3

onSearchEditTextEditMethod · 0.45
setCurrentSelectionMethod · 0.45
setCurrentIndexMethod · 0.45

Calls 1

countMethod · 0.80

Tested by

no test coverage detected