View Full Version : tableView shows part of model
Omid123
12th February 2015, 22:24
Hi
I would like to set into the tableview "part of data in a child" of my model.
rootIndex will show me ALL item of a child. But, I need to show part of a child in a certain tableview.
Cheers,
Omid
anda_skoa
13th February 2015, 07:55
You could use a proxy model to filter out the rows/columns you don't want to appear.
Cheers,
_
d_stranz
13th February 2015, 15:46
To expand on anda_skoa's answer, you need a class derived from QSortFilterProxyModel that reimplements the QSortFilterProxyModel::filterAcceptsRow() and / or QSortFilterProxyModel::filterAcceptsColumn() methods. These methods return true if the row or column should be displayed, false if not. You set your current model as the source model for the proxy, and you set the proxy as the model used by the view.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.