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

Method addTableRow

Gui/MultiInstancePanel.cpp:703–814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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