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

Method setData

App/Client/Favorite/FavoriteModel.cpp:177–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177bool CFavoriteModel::setData(const QModelIndex &index, const QVariant &value, int role)
178{
179 if(!index.isValid()) return false;
180 if(0 != index.column()) return false;
181 if (data(index, role) != value) {
182 if(Qt::EditRole == role) {
183 tree* ip = (tree*)index.internalPointer();
184 if(!ip) return false;
185 if(ip->item.isFavorite())
186 m_pDatabase->UpdateFavorite(ip->item.id, value.toString());
187 else
188 m_pDatabase->RenameNode(ip->item.id, value.toString());
189 ip->item.szName = value.toString();
190 }
191 emit dataChanged(index, index, {role});
192 return true;
193 }
194 return false;
195}
196
197Qt::ItemFlags CFavoriteModel::flags(const QModelIndex &index) const
198{

Callers 4

foreachFunction · 0.45
StartMethod · 0.45
GetStartActionMethod · 0.45
foreachFunction · 0.45

Calls 4

isValidMethod · 0.80
isFavoriteMethod · 0.80
RenameNodeMethod · 0.80
UpdateFavoriteMethod · 0.45

Tested by

no test coverage detected