[Qt-interest] QAbstractItemModel: Hiding rows

Arnold Krille arnold at arnoldarts.de
Thu Jul 9 21:45:34 CEST 2009


Hi,

On Thursday 09 July 2009 21:23:05 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.

Hiding a row (or column) in the model is "simply" a matter of removeRows() and 
removeColumns(). The model is only a representation of the data to show. So 
there is no hiding. Only not exposing it via the model.

There is a way to hide stuff without modifying your model: Use a proxy-model on 
top to hide (ie. not expose) your rows/columns. Then all the views attached to 
that proxy will get the filtered data.

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090709/1ce30908/attachment.bin 


More information about the Qt-interest-old mailing list