MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / data

Method data

App/Client/Favorite/FavoriteModel.cpp:148–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148QVariant CFavoriteModel::data(const QModelIndex &index, int role) const
149{
150 //qDebug(log) << "date:" << index;
151 if (!index.isValid())
152 return QVariant();
153 if(0 != index.column()) return QVariant();
154 tree* ip = static_cast<tree*>(index.internalPointer());
155 if(!ip) return QVariant();
156 auto item = ip->item;
157 switch(role) {
158 case Qt::DecorationRole:
159 return item.GetIcon();
160 case Qt::DisplayRole:
161 return item.szName;
162 case Qt::ToolTipRole:
163 return item.szDescription;
164 case CFavoriteModel::RoleFile:
165 return item.szFile;
166 case RoleNodeType:
167 return item.type;
168 case RoleItem:
169 return QVariant::fromValue(item);
170 default:
171 break;
172 }
173
174 return QVariant();
175}
176
177bool CFavoriteModel::setData(const QModelIndex &index, const QVariant &value, int role)
178{

Callers 7

EnableActionMethod · 0.45
slotAddToFavoriteMethod · 0.45
foreachFunction · 0.45
slotDeleteMethod · 0.45
slotNewGroupMethod · 0.45
dropEventMethod · 0.45

Calls 2

isValidMethod · 0.80
GetIconMethod · 0.45

Tested by

no test coverage detected