[Qt-qml] GridView with variable row height?

Martin Jones martin.jones at nokia.com
Mon Jul 26 02:10:38 CEST 2010


On Fri, 23 Jul 2010 08:55:40 pm ext Gregory Schlomoff wrote:
> Hi guys,
> 
> As far as I can see, GridView only supports cells that all have the same
> height and width. But what if you need to display data in a table, pretty
> much like an HTML table, that requires row of variable height to adapt to
> the content height?
> 
> So far, we can see several options :
> 
> 1. Use a Repeater to instantiate all our cells, then use JS + anchoring to
> anchor the cells to each other. Put the whole thing inside a Flickable,
> and you're done. But it is cumbersome.
> 
> 2. Make our own TableView element in C++, possibly by ripping some code off
> GridView. But it seems difficult (qdeclarativegridview.cpp is 2600 lines
> of code). And it is even harder as we have no easy access to other
> QDeclarative classes, like QDeclarativeFlickable
> 
> 3. Post to this mailing-list and hope that someone will find a solution, or
> even better, some troll will say "sure, let's just create a TableView
> element" :)
> 
> What are your thoughts on this?

How much data do you need to display?  If you don't mind having all items 
instantiated then you can get what you want with a Grid and Repeater.

If you have a lot of data, then I'm afraid option 2 is the best candidate.

-- 
Martin



More information about the Qt-qml mailing list