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

Method onRemoveButtonClicked

Gui/KnobGuiTable.cpp:420–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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