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

Method addTableRow

Gui/MultiInstancePanel.cpp:704–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

702}
703
704void
705MultiInstancePanelPrivate::addTableRow(const NodePtr & node)
706{
707 for (Nodes::iterator it = instances.begin(); it != instances.end(); ++it) {
708 if (it->first.lock() == node) {
709 return;
710 }
711 }
712
713 instances.push_back( std::make_pair(node, false) );
714 int newRowIndex = view->rowCount();
715 model->insertRow(newRowIndex);
716
717 std::list<KnobIPtr> instanceSpecificKnobs;
718 {
719 const std::vector<KnobIPtr> & instanceKnobs = node->getKnobs();
720 for (U32 i = 0; i < instanceKnobs.size(); ++i) {
721 KnobSignalSlotHandlerPtr slotsHandler =
722 instanceKnobs[i]->getSignalSlotHandler();
723 if (slotsHandler) {
724 QObject::connect( slotsHandler.get(), SIGNAL(valueChanged(ViewSpec,int,int)), publicInterface, SLOT(onInstanceKnobValueChanged(ViewSpec,int,int)) );
725 }
726
727 if ( instanceKnobs[i]->isInstanceSpecific() ) {
728 KnobInt* isInt = dynamic_cast<KnobInt*>( instanceKnobs[i].get() );
729 KnobBool* isBool = dynamic_cast<KnobBool*>( instanceKnobs[i].get() );
730 KnobDouble* isDouble = dynamic_cast<KnobDouble*>( instanceKnobs[i].get() );
731 KnobColor* isColor = dynamic_cast<KnobColor*>( instanceKnobs[i].get() );
732 KnobString* isString = dynamic_cast<KnobString*>( instanceKnobs[i].get() );
733 if (!isInt && !isBool && !isDouble && !isColor && !isString) {
734 qDebug() << "Multi-instance panel doesn't support the following type of knob: " << instanceKnobs[i]->typeName().c_str();
735 continue;
736 }
737
738 instanceSpecificKnobs.push_back(instanceKnobs[i]);
739 }
740 }
741 }
742
743
744 ///first add the enabled column
745 {
746 QCheckBox* checkbox = new QCheckBox();
747 checkbox->setChecked( !node->isNodeDisabled() );
748 QObject::connect( checkbox, SIGNAL(toggled(bool)), publicInterface, SLOT(onCheckBoxChecked(bool)) );
749 view->setCellWidget(newRowIndex, COL_ENABLED, checkbox);
750 TableItem* newItem = new TableItem;
751 newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable);
752 view->setItem(newRowIndex, COL_ENABLED, newItem);
753 view->resizeColumnToContents(COL_ENABLED);
754 }
755
756 ///Script name
757 {
758 TableItem* newItem = new TableItem;
759 view->setItem(newRowIndex, COL_SCRIPT_NAME, newItem);
760 newItem->setToolTip( tr("The script-name of the item as exposed to Python scripts") );
761 newItem->setText( QString::fromUtf8( node->getScriptName().c_str() ) );

Callers 2

onChildCreatedMethod · 0.45
addRowMethod · 0.45

Calls 15

insertRowMethod · 0.80
isInstanceSpecificMethod · 0.80
isNodeDisabledMethod · 0.80
setCellWidgetMethod · 0.80
setFlagsMethod · 0.80
setItemMethod · 0.80
getNameMethod · 0.80
appendMethod · 0.80
getHintToolTipMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected