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

Method insertRows

Gui/TableModelView.cpp:238–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238bool
239TableModel::insertRows(int row,
240 int count,
241 const QModelIndex &)
242{
243 if ( (count < 1) || (row < 0) || (row > _imp->rowCount) ) {
244 return false;
245 }
246 beginInsertRows(QModelIndex(), row, row + count - 1);
247 _imp->rowCount += count;
248 int cc = _imp->horizontalHeaderItems.size();
249 if (_imp->rowCount == 0) {
250 _imp->tableItems.resize(cc * count);
251 } else {
252 std::vector<TableItem*>::iterator pos = _imp->tableItems.begin();
253 int idx = tableIndex(row, 0);
254 if ( idx < (int)_imp->tableItems.size() ) {
255 std::advance(pos, idx);
256 _imp->tableItems.insert(pos, cc * count, (TableItem*)0);
257 } else {
258 _imp->tableItems.insert(_imp->tableItems.end(), cc * count, (TableItem*)0);
259 }
260 }
261 endInsertRows();
262
263 return true;
264}
265
266bool
267TableModel::insertColumns(int column,

Callers 1

dropEventMethod · 0.80

Calls 6

QModelIndexClass · 0.85
sizeMethod · 0.45
resizeMethod · 0.45
beginMethod · 0.45
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected