| 387 | } |
| 388 | |
| 389 | void |
| 390 | KnobGuiTable::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 | |
| 421 | void |
| 422 | KnobGuiTable::onRemoveButtonClicked() |
nothing calls this directly
no test coverage detected