MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / data

Method data

test/cli/QML-Samples-TableView/samplemodel.cpp:15–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15QVariant SampleModel::data(const QModelIndex &index, int role) const
16{
17 if (!index.isValid())
18 return QVariant();
19 if (index.row() < 0 || index.row() > _data.count() - 1)
20 return QVariant();
21
22 auto row = _data.at(index.row());
23
24 switch (role) {
25 case IdRole:
26 return index.row();
27
28 case NameRole:
29 return row.first;
30
31 case GradeRole:
32 return row.second;
33 }
34
35 return QVariant();
36}
37
38QHash<int, QByteArray> SampleModel::roleNames() const
39{

Callers 11

testMissingInclude5Method · 0.45
testMissingInclude6Method · 0.45
cpp11initMethod · 0.45
tokenizeMethod · 0.45
MacroTest2_testFunction · 0.45
stream_writeFunction · 0.45
stdspanFunction · 0.45

Calls 1

atMethod · 0.80

Tested by 6

testMissingInclude5Method · 0.36
testMissingInclude6Method · 0.36
cpp11initMethod · 0.36