<div dir="ltr"><div dir="ltr"><div>Thanks a lot. <br></div><div>That fixed my problem dear maurizio.<br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 12, 2018 at 11:52 PM Maurizio Berti <<a href="mailto:maurizio.berti@gmail.com">maurizio.berti@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">That might depend on the size of the table: according to the Sql driver support you're using, QSqlTableModel could decide to not load automatically all data, but only part of it (usually around 500 rows, if I recall correctly) to increase performance, meaning that resizeRowsToContents will only resize the items fetched at the time it was called; you can see this behavior by looking at the extent of the vertical scrollbar, which will resize as soon as you're reaching the last items fetched, since the contents of the scrollArea will have changed due to the increased size.<div>You can do this to ensure that all data is fetched, <b>before</b> calling resizeRowsToContents:</div><div><br></div><div><font face="monospace, monospace">    while model.canFetchMore():</font></div><div><font face="monospace, monospace">        model.fetchMore()</font></div><div><br></div><div>This obviously is not very well suited for very big data results, as both the resize*ToContents methods can become very slow in these situations.<br>Also, keep in mind that if you want all rows to have the same height, you can also use defaultSectionSize or, better, create your own subclassed QHeaderView and implement any method that reports sizes (which one depends on your needs): sectionSize(), sectionSizeFromContents() or sectionSizeHint().</div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno lun 12 nov 2018 alle ore 15:28 Maziar Parsijani <<a href="mailto:maziar.parsijani@gmail.com" target="_blank">maziar.parsijani@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>Thanks for that Idea but I have a problem with it when resizerowstocontents.</div><div>It doesn't resize all the rows.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Nov 11, 2018 at 11:30 PM Maurizio Berti <<a href="mailto:maurizio.berti@gmail.com" target="_blank">maurizio.berti@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Use QSqlTableModel, it's automatically updated according to its EditStrategy.</div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_-6686898474474369740gmail_signature" data-smartmail="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div>
</blockquote></div>