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