[Qt-interest] FW: QAbstractItemModel: Hiding rows
Eric Clark
eclark at ara.com
Thu Jul 9 22:46:14 CEST 2009
Sorry for responding directly to you Brad, it was an accident when replying. :)
From: Eric Clark
Sent: Thursday, July 09, 2009 3:40 PM
To: 'Brad Howes'
Subject: RE: [Qt-interest] QAbstractItemModel: Hiding rows
Thank you. I think you are suggesting that I just add a new role to the data role? Is that correct? And then have my View use that role to determine if the row should be hidden or not? I like this idea, but could I just add a new flag to the flags function as well?
Thanks,
Eric
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Brad Howes
Sent: Thursday, July 09, 2009 2:41 PM
To: Qt Interest (qt-interest at trolltech.com)
Subject: Re: [Qt-interest] QAbstractItemModel: Hiding rows
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/7b85b1e2/attachment.html
More information about the Qt-interest-old
mailing list