Am 13.07.2023 um 07:37 schrieb EXT Mitch Curtis:
-----Original Message-----
From: Arno Rehn <a.r...@menlosystems.com>
We have a vertical ListView which shows icon-only buttons. The buttons all
have the same width, but depending on the icon size and/or the style, that
width may differ. So we update the contentWidth of the ListView as soon as
the first button is loaded. Something like this:
[...]
Maybe we're doing this wrong; but I didn't find any other viable
way to have a ListView auto-determine the size in the
non-scrollable dimension based on its content.
I'd recommend setting a size on the ListView that doesn't depend on
the implicit size of the delegates; one that is calculated with
TextMetrics, for example. The reason for this is that it's not always
possible to know the size of every delegate at startup. While
scrolling a view, delegates that are larger or smaller might be
loaded.
[...]
So, this is definitely an area that could be improved, but the
simplest and most performant solution will always be to set a
pre-calculated size on the ListView.
Thanks for the very extensive answer! Definitely some things in there
that I'll dig into.
I know about the drawbacks of our approach of sizing the ListView; we
chose it only because we knew in advance that all our delegates have the
same size. The thing about implicitWidth being only correct after doing
text layout is a good point though; could happen with icons as well.
I still wouldn't have put this change in a patch-level release, but I
see that it's kind of a gray area.
Guess we'll have to read the release notes more closely next time :-)
Regards,
Arno
--
Arno Rehn
Tel +49 89 189 166 0
Fax +49 89 189 166 111
a.r...@menlosystems.com
www.menlosystems.com
Menlo Systems GmbH
Bunsenstrasse 5, D-82152 Martinsried, Germany
Amtsgericht München HRB 138145
Geschäftsführung: Dr. Michael Mei, Dr. Ronald Holzwarth
USt.-IdNr. DE217772017, St.-Nr. 14316170324
--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development