| 860 | } |
| 861 | |
| 862 | void |
| 863 | MultiInstancePanel::selectNodes(const std::list<Node*> & nodes, |
| 864 | bool addToSelection) |
| 865 | { |
| 866 | //_imp->view->selectionModel()->blockSignals(true); |
| 867 | if (!addToSelection) { |
| 868 | _imp->view->clearSelection(); |
| 869 | } |
| 870 | // for (std::list<std::pair<NodePtr,bool > >::iterator it2 = _imp->instances.begin(); |
| 871 | // it2!=_imp->instances.end(); ++it2) { |
| 872 | // it2->second = false; |
| 873 | // } |
| 874 | // _imp->view->selectionModel()->blockSignals(false); |
| 875 | if ( nodes.empty() ) { |
| 876 | return; |
| 877 | } |
| 878 | |
| 879 | |
| 880 | QItemSelection newSelection; |
| 881 | for (std::list<Node*>::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { |
| 882 | int i = 0; |
| 883 | for (std::list<std::pair<NodeWPtr, bool > >::iterator it2 = _imp->instances.begin(); |
| 884 | it2 != _imp->instances.end(); ++it2, ++i) { |
| 885 | if (it2->first.lock().get() == *it) { |
| 886 | QItemSelection sel( _imp->model->index(i, 0), _imp->model->index(i, _imp->view->columnCount() - 1) ); |
| 887 | newSelection.merge(sel, QItemSelectionModel::Select); |
| 888 | break; |
| 889 | } |
| 890 | } |
| 891 | } |
| 892 | _imp->view->selectionModel()->select(newSelection, QItemSelectionModel::Select); |
| 893 | } |
| 894 | |
| 895 | class RemoveNodeCommand |
| 896 | : public QUndoCommand |
nothing calls this directly
no test coverage detected