开发者

Edit all selected items into one editor

开发者 https://www.devze.com 2023-02-14 06:34 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消