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

Method removeRows

App/Client/Favorite/FavoriteModel.cpp:205–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205bool CFavoriteModel::removeRows(int row, int count, const QModelIndex &parent)
206{
207 tree* pItem = GetTree(parent);
208 if(!pItem || 0 > row || row + count > pItem->ChildCount())
209 return false;
210
211 beginRemoveRows(parent, row, row + count - 1);
212 for(int i = row; i < row + count; i++) {
213 auto t = pItem->children[i];
214 if(!t) continue;
215 if(t->item.isFolder()) {
216 m_pDatabase->DeleteNode(t->item.id, true);
217 m_Folders.remove(t->item.id);
218 } else {
219 m_pDatabase->Delete(t->item.id, true);
220 }
221 pItem->RemoveChild(t);
222 ClearTree(t);
223 }
224 endRemoveRows();
225 emit dataChanged(parent, parent);
226 return true;
227}
228
229bool CFavoriteModel::AddFavorite(
230 const QString &szFile, const QString& szName, const QIcon &icon,

Callers

nothing calls this directly

Calls 5

DeleteNodeMethod · 0.80
DeleteMethod · 0.80
ChildCountMethod · 0.45
isFolderMethod · 0.45
RemoveChildMethod · 0.45

Tested by

no test coverage detected