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

Method data

ElaWidgetToolsExample/ModelView/T_TableViewModel.cpp:92–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91int T_TableViewModel::columnCount(const QModelIndex& parent) const
92{
93 if (parent.isValid())
94 {
95 return 0;
96 }
97 return _header.count();
98}
99
100QVariant T_TableViewModel::data(const QModelIndex& index, int role) const
101{
102 if (!index.isValid() || index.row() < 0 || index.row() >= rowCount() || index.column() < 0 || index.column() >= columnCount())
103 {
104 return QVariant();
105 }
106 if ((role == Qt::DisplayRole || role == Qt::ToolTipRole) && index.column() != 0)
107 {
108 return _dataList[index.row() % 9][index.column() - 1];
109 }
110 else if (role == Qt::DecorationRole && index.column() == 0)
111 {
112 return _iconList[index.row() % 9];
113 }
114 else if (role == Qt::DecorationPropertyRole)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected