[Qt-interest] FW: QAbstractItemModel: Hiding rows

Arnold Krille arnold at arnoldarts.de
Fri Jul 10 19:26:41 CEST 2009


Hi,

On Friday 10 July 2009 17:52:30 Brad Howes wrote:
> On Jul 10, 2009, at 4:32 AM, Arnold Krille wrote:
> > So actually your model is already a proxy to the real data:-) And
> > all you want
> > to know is what method of hiding some data from the proxies is least
> > costly.
> > As I said, either 1) hide it directly in your model (yes, that
> > involves index-
> > reordering) or 2) do it via a proxymodel (yes, that involves index-
> > reordering)...
> There is no reason at all to do it this way.
> > The model-view concept is actualy working like this: The views show
> > everything
> > exported by the model. And its the models responsibility to hide
> > what is not
> > to be shown.
> Wrong.
> > If you try to introduce a new role, you also have to implement your
> > own
> > views/delegates to be used with your model.
> Wrong.
> > And that is counter-productive. The advantage of the model-view-
> > pattern is that (almost) all views can display
> > the data given in the model. Some my not look interesting (imagine a
> > chart-
> > view coupled to a QDirModel:), but all work without modifications or
> > big
> > specializations.
> There are so many mischaracterizations of MVC and of how Qt does
> things here.

I don't mind telling me when I am wrong. But could you _please_ explain why? 
(Trying to learn.)

What do you propose? Introducing a new flag/role in the model? And then modify 
all views to respect the flag? Somehow this still seems to be counter-
productive to the fact that with the standard-interface you can just connect a 
view to a model (without special things) and get something useful as intended.

Take for example a simple table that contains the results of some experiments. 
Regardless whether you connect a TableView, a ChartView or a 
OpenGL3DChartView, if (like the original poster) you want a row of data to be 
hidden in all views, you have (to the best of my knowledge) no other 
possibilities then either not publish/expose that row in the model in the first 
place or plug a proxy between model and view to hide the row there. And both 
involve reordering the indizes.

Please tell me where I mis-understand the model-view-pattern!

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/20090710/6870e65e/attachment.bin 


More information about the Qt-interest-old mailing list