Edit all selected items into one editor
Using QTableView I would like to be able to select multip开发者_JAVA百科le cells and change all selected cells at once. How I can do it?
I'm not sure exactly what you mean by "changing" the selected cells (content, formatting, something else?) but I think QTableView::selectedIndexes()
(or QTableView::selectionModel()
if you need more power) is going to help out. You can loop through the returned indexes and update your underlying model.
If you are using a QSortFilterProxyModel
you will have to use the QSortFilterProxyModel::mapFromSource()
and related methods to map from the selected cells on your table view to the actual model indexes.
精彩评论