MCPcopy Create free account
hub / github.com/KDE/kdevelop / rowCount

Method rowCount

kdevplatform/sublime/aggregatemodel.cpp:95–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95int AggregateModel::rowCount(const QModelIndex &parent) const
96{
97 Q_D(const AggregateModel);
98
99 if (!parent.isValid())
100 {
101 //toplevel items represent aggregated models
102 return d->modelList.count();
103 }
104 else
105 {
106 //Qt model guideline - only 1st column has children
107 if (parent.column() != 0)
108 return 0;
109
110 //find out if the parent is an aggregator
111 if (parent.internalPointer() == d->internal)
112 {
113 //return the number of toplevel rows in the source model
114 return d->modelList[parent.row()]->rowCount(QModelIndex());
115 }
116 else
117 {
118 //we have a standard item in the source model - just map it into our model
119 auto *item = static_cast<QStandardItem*>(parent.internalPointer());
120 return item->rowCount();
121 }
122 }
123}
124
125QVariant AggregateModel::data(const QModelIndex &index, int role) const
126{

Callers

nothing calls this directly

Calls 5

QModelIndexClass · 0.50
isValidMethod · 0.45
countMethod · 0.45
columnMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected