MCPcopy Create free account
hub / github.com/XRay3D/GERBER_X3 / parent

Method parent

static_libs/filetree/ft_model.cpp:133–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133QModelIndex Model::parent(const QModelIndex& index) const
134{
135 // if (!index.isValid())
136 // return QModelIndex();
137 // TreeItem* childItem = static_cast<TreeItem*>(index.internalPointer());
138 // TreeItem* parentItem = childItem->parent();
139 // if (parentItem == rootItem)
140 // return QModelIndex();
141 // return createIndex(parentItem->row(), 0, parentItem);
142
143 if (!index.isValid())
144 return QModelIndex();
145 Node* parentItem = getItem(index)->parent();
146 if (parentItem == rootItem)
147 return QModelIndex();
148 return createIndex(parentItem->row(), /*index.column()*/ 0, parentItem);
149}
150
151QVariant Model::data(const QModelIndex& index, int role) const
152{

Callers

nothing calls this directly

Calls 2

isValidMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected