[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] [pyqt5]update sqlite database from qtwidgets.qtablewidget
From:       Maziar Parsijani <maziar.parsijani () gmail ! com>
Date:       2018-11-13 7:21:23
Message-ID: CAPD04aO_kVANDrF6uTkB5yb7qch70QPV6zD71o17iWNbZ_e4BQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks a lot.
That fixed my problem dear maurizio.

On Mon, Nov 12, 2018 at 11:52 PM Maurizio Berti <maurizio.berti@gmail.com>
wrote:

> That might depend on the size of the table: according to the Sql driver
> support you're using, QSqlTableModel could decide to not load automatical=
ly
> all data, but only part of it (usually around 500 rows, if I recall
> correctly) to increase performance, meaning that resizeRowsToContents wil=
l
> 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.
> You can do this to ensure that all data is fetched, *before* calling
> resizeRowsToContents:
>
>     while model.canFetchMore():
>         model.fetchMore()
>
> 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.
> 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 depend=
s
> on your needs): sectionSize(), sectionSizeFromContents() or
> sectionSizeHint().
>
>
> Il giorno lun 12 nov 2018 alle ore 15:28 Maziar Parsijani <
> maziar.parsijani@gmail.com> ha scritto:
>
>> Hi,
>> Thanks for that Idea but I have a problem with it when
>> resizerowstocontents.
>> It doesn't resize all the rows.
>>
>> On Sun, Nov 11, 2018 at 11:30 PM Maurizio Berti <maurizio.berti@gmail.co=
m>
>> wrote:
>>
>>> Use QSqlTableModel, it's automatically updated according to its
>>> EditStrategy.
>>>
>>
>
> --
> =C3=88 difficile avere una convinzione precisa quando si parla delle ragi=
oni
> del cuore. - "Sostiene Pereira", Antonio Tabucchi
> http://www.jidesk.net
>

[Attachment #5 (text/html)]

<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 &lt;<a \
href="mailto:maurizio.berti@gmail.com">maurizio.berti@gmail.com</a>&gt; \
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&#39;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&#39;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 &lt;<a href="mailto:maziar.parsijani@gmail.com" \
target="_blank">maziar.parsijani@gmail.com</a>&gt; 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&#39;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 &lt;<a href="mailto:maurizio.berti@gmail.com" \
target="_blank">maurizio.berti@gmail.com</a>&gt; 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&#39;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. - \
&quot;Sostiene Pereira&quot;, Antonio Tabucchi<br><a href="http://www.jidesk.net" \
target="_blank">http://www.jidesk.net</a></div> </blockquote></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic