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

Method onEditButtonClicked

Gui/KnobGuiTable.cpp:389–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389void
390KnobGuiTable::onEditButtonClicked()
391{
392 KnobTablePtr knob = std::dynamic_pointer_cast<KnobTable>( getKnob() );
393
394 assert(knob);
395 std::string oldTable = knob->getValue();
396 QModelIndexList selection = _imp->table->selectionModel()->selectedRows();
397
398 if (selection.size() != 1) {
399 return;
400 }
401
402 if ( (selection[0].row() >= 0) && ( selection[0].row() < (int)_imp->items.size() ) ) {
403 Row& r = _imp->items[selection[0].row()];
404 QStringList row;
405 for (std::size_t i = 0; i < r.items.size(); ++i) {
406 row.push_back( r.items[i]->text() );
407 }
408 if ( !editUserEntry(row) ) {
409 return;
410 }
411
412 for (std::size_t i = 0; i < r.items.size(); ++i) {
413 r.items[i]->setText(row[i]);
414 }
415
416 std::string newTable = _imp->encodeTable(knob);
417 pushUndoCommand( new KnobUndoCommand<std::string>( shared_from_this(), oldTable, newTable) );
418 }
419}
420
421void
422KnobGuiTable::onRemoveButtonClicked()

Callers

nothing calls this directly

Calls 8

pushUndoCommandFunction · 0.85
encodeTableMethod · 0.80
getKnobFunction · 0.70
getValueMethod · 0.45
sizeMethod · 0.45
rowMethod · 0.45
push_backMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected