MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / removeRows

Method removeRows

Gui/TableModelView.cpp:306–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306bool
307TableModel::removeRows(int row,
308 int count,
309 const QModelIndex &)
310{
311 if ( (count < 1) || (row < 0) || (row + count > _imp->rowCount) ) {
312 return false;
313 }
314
315 beginRemoveRows(QModelIndex(), row, row + count - 1);
316 int i = tableIndex(row, 0);
317 int n = count * columnCount();
318 TableItem *oldItem = 0;
319 for (int j = i; j < n + i; ++j) {
320 oldItem = _imp->tableItems.at(j);
321 if (oldItem) {
322 oldItem->view = 0;
323 }
324 delete oldItem;
325 }
326 _imp->rowCount -= count;
327
328 std::vector<TableItem*>::iterator pos = _imp->tableItems.begin();
329 int idx = std::max(i, 0);
330 if ( idx < (int)_imp->tableItems.size() ) {
331 std::advance(pos, idx);
332 std::vector<TableItem*>::iterator last = pos;
333 if ( (idx + n) < (int)_imp->tableItems.size() ) {
334 std::advance(last, n);
335 } else {
336 last = _imp->tableItems.end();
337 }
338 _imp->tableItems.erase(pos, last);
339 }
340
341 endRemoveRows();
342
343 return true;
344}
345
346bool
347TableModel::removeColumns(int column,

Callers 4

onRemoveButtonClickedMethod · 0.80
removeRowMethod · 0.80
dropEventMethod · 0.80
removeRowMethod · 0.80

Calls 7

QModelIndexClass · 0.85
maxFunction · 0.85
atMethod · 0.80
beginMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected