The checkbox interacts directly with the kDisableNodeKnobName knob of the node It doesn't call deactivate() on the node so calling isActivated() on a node will still return true even if you set the value of kDisableNodeKnobName to false.
| 1412 | ///It doesn't call deactivate() on the node so calling isActivated() on a node |
| 1413 | ///will still return true even if you set the value of kDisableNodeKnobName to false. |
| 1414 | void |
| 1415 | MultiInstancePanel::onCheckBoxChecked(bool checked) |
| 1416 | { |
| 1417 | QCheckBox* checkbox = qobject_cast<QCheckBox*>( sender() ); |
| 1418 | |
| 1419 | if (!checkbox) { |
| 1420 | return; |
| 1421 | } |
| 1422 | |
| 1423 | |
| 1424 | ///find the row which owns this checkbox |
| 1425 | int rc = _imp->model->rowCount(); |
| 1426 | int cc = _imp->model->columnCount(); |
| 1427 | for (int i = 0; i < rc; ++i) { |
| 1428 | //TableItem* item = _imp->view->itemAt(i, COL_ENABLED); |
| 1429 | QWidget* w = _imp->view->cellWidget(i, COL_ENABLED); |
| 1430 | if (w == checkbox) { |
| 1431 | //assert(item); |
| 1432 | assert( i < (int)_imp->instances.size() ); |
| 1433 | Nodes::iterator it = _imp->instances.begin(); |
| 1434 | std::advance(it, i); |
| 1435 | KnobIPtr enabledKnob = it->first.lock()->getKnobByName(kDisableNodeKnobName); |
| 1436 | assert(enabledKnob); |
| 1437 | KnobBool* bKnob = dynamic_cast<KnobBool*>( enabledKnob.get() ); |
| 1438 | assert(bKnob); |
| 1439 | bKnob->setValue(!checked); |
| 1440 | QItemSelection sel; |
| 1441 | QItemSelectionRange r( _imp->model->index(i, 0), _imp->model->index(i, cc - 1 ) ); |
| 1442 | sel.append(r); |
| 1443 | |
| 1444 | if (!checked) { |
| 1445 | _imp->view->selectionModel()->select(sel, QItemSelectionModel::Clear); |
| 1446 | } else { |
| 1447 | _imp->view->selectionModel()->select(sel, QItemSelectionModel::Select); |
| 1448 | } |
| 1449 | break; |
| 1450 | } |
| 1451 | } |
| 1452 | getApp()->redrawAllViewers(); |
| 1453 | } |
| 1454 | |
| 1455 | void |
| 1456 | MultiInstancePanel::onInstanceKnobValueChanged(ViewSpec /*view*/, |
nothing calls this directly
no test coverage detected