[Interest] [QML] Dynamic sizing: How to tell GridView to size itself to fit its contents?

Viktória Nemkin viktoria.nemkin at gmail.com
Wed May 25 16:18:25 CEST 2016


Hello!

I have a GridView, its delegate is a Text.

What is the easiest way to tell GridView to size itself to fit its contents?

I am currently trying to do it like this:

We can calculate each cells' size with TextMetrics from the Text element in
it. Then set all columns' and rows' width/height to the maximum
width/height cell in it. Add these up and we have a width and height for
GridView. Also this should happen after the elements are loaded from the
model.

I am wondering if there is a simpler solution that I overlooked.

Thank you,
Viki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160525/64f7d976/attachment.html>


More information about the Interest mailing list