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

Method data

ElaWidgetToolsExample/ModelView/T_IconModel.cpp:41–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41QVariant T_IconModel::data(const QModelIndex& index, int role) const
42{
43 if (role == Qt::UserRole)
44 {
45 if (!_pIsSearchMode)
46 {
47 if (index.row() >= _metaEnum.keyCount() - 1)
48 {
49 return QVariant();
50 }
51 return QStringList{_metaEnum.key(index.row() + 1), QChar(_metaEnum.value(index.row() + 1))};
52 }
53 else
54 {
55 QStringList iconList;
56 if (index.row() >= _searchKeyList.count())
57 {
58 return QVariant();
59 }
60 iconList.append(_searchKeyList.at(index.row()));
61 iconList.append(QChar(_metaEnum.keyToValue(_searchKeyList.at(index.row()).toUtf8().constData())));
62 return iconList;
63 }
64 }
65 return QVariant();
66}
67
68QString T_IconModel::getIconNameFromModelIndex(const QModelIndex& index) const
69{

Callers

nothing calls this directly

Calls 1

countMethod · 0.80

Tested by

no test coverage detected