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

Method onRemoveButtonClicked

Gui/KnobGuiTable.cpp:421–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421void
422KnobGuiTable::onRemoveButtonClicked()
423{
424 KnobTablePtr knob = std::dynamic_pointer_cast<KnobTable>( getKnob() );
425
426 assert(knob);
427 QModelIndexList selection = _imp->table->selectionModel()->selectedRows();
428
429 if (selection.size() < 1) {
430 return;
431 }
432
433
434 for (int i = 0; i < selection.size(); ++i) {
435 QStringList removedRow;
436 if ( (selection[0].row() >= 0) && ( selection[0].row() < (int)_imp->items.size() ) ) {
437 Row& r = _imp->items[selection[0].row()];
438 for (std::size_t i = 0; i < r.items.size(); ++i) {
439 removedRow.push_back( r.items[i]->text() );
440 }
441 _imp->items.erase( _imp->items.begin() + selection[0].row() );
442 }
443
444 entryRemoved(removedRow);
445 }
446
447 _imp->model->removeRows( selection.front().row(), selection.size() );
448
449
450 std::string oldTable = knob->getValue();
451 std::string newTable = _imp->encodeTable(knob);
452 pushUndoCommand( new KnobUndoCommand<std::string>( shared_from_this(), oldTable, newTable) );
453}
454
455void
456KnobGuiTable::updateGUI(int /*dimension*/)

Callers

nothing calls this directly

Calls 10

pushUndoCommandFunction · 0.85
removeRowsMethod · 0.80
encodeTableMethod · 0.80
getKnobFunction · 0.70
sizeMethod · 0.45
rowMethod · 0.45
push_backMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected