[Qt-interest] QAbstractItemModel: Hiding rows

Brad Howes howes at ll.mit.edu
Thu Jul 9 21:40:37 CEST 2009


On Jul 9, 2009, at 3:23 PM, Eric Clark wrote:

> Is anyone aware of a way to tell the QAbstractItemViews that a row  
> is hidden in the QAbstractItemModel from the model class? I know you  
> can hide the row from the view, but I would like to be able to tell  
> the view it is hidden from the model, like as a part of the flags or  
> something.

There are various ways, but there is not a stock 'isVisible' flag for  
model items that I am aware of. For an application I wrote that had a  
search field, as the user typed into the search field, I would  
reevaluate an isFiltered() method for each model item, executing  
setRowHidden appropriately. If the model changes dynamically, say from  
new data over the network, you could provide a 'visible'  value from  
the model data() method (at least that is what I'd try first).

Brad

-- 
Brad Howes
Group 42
MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090709/5b8ba961/attachment.html 


More information about the Qt-interest-old mailing list