I’d like to access the active (highlighted) cell in a table in the MRML scene from the Python interactor. I thought this property might be in the vtkMRMLTableNode or vtkMRMLTableViewNode. Is there someplace else I should look? Thanks!
You can get selected column indices using qMRMLTableView::selectedMRMLTableColumnIndices()`. Feel free to add more methods (for example to return (row,col) indices, or use more Python-friendly return types) and send a pull request.
Table view also has a selectionChanged()
signal that you can observe to get notified when selection is changed.
Thanks @lassoan. I can get the qMRMLTableView when I instantiate the widget, could you explain how to get it from the scene?
Would you like to access a table view that is in the view layout?
You can access it by calling slicer.app.layoutManager().tableWidget(0).tableView()
.
Thanks @lassoan! This works perfectly.
1 Like