Using QTableView I would like to be able to select multiple cells and change all selected cells at once. How I can do it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure exactly what you mean by “changing” the selected cells (content, formatting, something else?) but I think
QTableView::selectedIndexes()(orQTableView::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
QSortFilterProxyModelyou will have to use theQSortFilterProxyModel::mapFromSource()and related methods to map from the selected cells on your table view to the actual model indexes.