| 702 | } |
| 703 | |
| 704 | void |
| 705 | MultiInstancePanelPrivate::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() ) ); |
no test coverage detected