| 815 | } // addTableRow |
| 816 | |
| 817 | void |
| 818 | MultiInstancePanel::selectNode(const NodePtr & node, |
| 819 | bool addToSelection) |
| 820 | { |
| 821 | if (!addToSelection) { |
| 822 | _imp->view->selectionModel()->clear(); |
| 823 | } |
| 824 | |
| 825 | int index = -1; |
| 826 | int i = 0; |
| 827 | for (std::list<std::pair<NodeWPtr, bool > >::iterator it = _imp->instances.begin(); it != _imp->instances.end(); ++it, ++i) { |
| 828 | if (it->first.lock() == node) { |
| 829 | index = i; |
| 830 | break; |
| 831 | } |
| 832 | } |
| 833 | assert(index != -1); |
| 834 | |
| 835 | QItemSelection newSelection( _imp->model->index(index, 0), _imp->model->index(index, _imp->view->columnCount() - 1) ); |
| 836 | _imp->view->selectionModel()->select(newSelection, QItemSelectionModel::Select); |
| 837 | } |
| 838 | |
| 839 | void |
| 840 | MultiInstancePanel::removeNodeFromSelection(const NodePtr & node) |