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

Method onCheckBoxChecked

Gui/MultiInstancePanel.cpp:1414–1453  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
1414void
1415MultiInstancePanel::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
1455void
1456MultiInstancePanel::onInstanceKnobValueChanged(ViewSpec /*view*/,

Callers

nothing calls this directly

Calls 14

getAppFunction · 0.85
cellWidgetMethod · 0.80
appendMethod · 0.80
rowCountMethod · 0.45
columnCountMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
getKnobByNameMethod · 0.45
lockMethod · 0.45
getMethod · 0.45
setValueMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected