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

List:       pykde
Subject:    Re: [PyQt] Scroll QTableView beyond last column/row
From:       Paul Du Bois <dubois () doublefine ! com>
Date:       2013-08-29 20:28:58
Message-ID: CAJr-ZGDKA8OfFzKccmbY5xGh-SRs+B-YE+ZwuhYJ6xws12JWzg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hmmm. I haven't seen that behavior, but it might be specific to particular
Qt versions (I'm on a slightly old one). I think the general idea of only
futzing with the scrollarea/scrollbar is pretty sound, though. You might
get some traction on that bug by checking to see if it's the scrollbar
that's getting its range changed (or its value changed) behind your back
somehow, or if someone's moving the view independently of the scrollbar.

p


On Thu, Aug 29, 2013 at 5:39 AM, Mark Mordeca <mark.mordeca@prosensus.ca>wrote:

> Thanks,  this is pretty much provides the behaviour I want, however there
> is one oddity with it.  It allows me to successfully scroll past the last
> row, but at a certain point I will be able to move the scroll bar to the
> very end which causes the entire table to "snap" back to the bottom.  Did
> you find a way to avoid this?
>
>
>
> Appreciate your help.
>
>
>
> *From:* Paul Du Bois [mailto:dubois@doublefine.com]
> *Sent:* August-28-13 4:34 PM
> *To:* Mark Mordeca
> *Cc:* pyqt@riverbankcomputing.com
> *Subject:* Re: [PyQt] Scroll QTableView beyond last column/row
>
>
>
> I do this:
>
>
>
>         # somewhere in init
>
>         self._last_vsb_height = None
>
>
> self.verticalScrollBar().rangeChanged[int,int].connect(self._on_range_changed)
>
>
>
>     def _on_range_changed(self, min, max):
>
>         # Try to prevent infinite recursion
>
>         # Count is in rows
>
>         if max != self._last_vsb_height:
>
>             sender = self.verticalScrollBar()
>
>             self._last_vsb_height = max + 20
>
>             sender.setRange(min, self._last_vsb_height)
>
>
>
>
>
> On Wed, Aug 28, 2013 at 12:28 PM, Mark Mordeca <mark.mordeca@prosensus.ca>
> wrote:
>
> Greetings,
>
>
>
> I have a simple QTableView connected to an QAbstractTableModel.  For the
> purposes of my question, let's assume that these are the most basic you can
> have in order to get a table with data in it.
>
>
>
> Default behaviour is that you can scroll the table so that the last
> column/row becomes visible, but no further.  I would like to be able to
> scroll the table *past* the last row/column, i.e. I want to be able to
> continue to click right on the horizontal scroll bar even though I have
> reached the last column, thereby making the last column continue to shift
> left in the table revealing "empty space" in the TableView.
>
>
>
> I have been unsuccessful in trying to find a way and hoped that someone
> here had a way to do this or a suggestion as to how.
>
>
>
> Thank you,
>
> Mark
>
>
>
>
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_default" style="color:#003300">Hmmm. I haven&#39;t \
seen that behavior, but it might be specific to particular Qt versions (I&#39;m on a \
slightly old one). I think the general idea of only futzing with the \
scrollarea/scrollbar is pretty sound, though. You might get some traction on that bug \
by checking to see if it&#39;s the scrollbar that&#39;s getting its range changed (or \
its value changed) behind your back somehow, or if someone&#39;s moving the view \
independently of the scrollbar.</div>

<div class="gmail_default" style="color:#003300"><br></div><div class="gmail_default" \
style="color:#003300">p</div></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Thu, Aug 29, 2013 at 5:39 AM, Mark Mordeca <span \
dir="ltr">&lt;<a href="mailto:mark.mordeca@prosensus.ca" \
target="_blank">mark.mordeca@prosensus.ca</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div lang="EN-CA" link="blue" vlink="purple"><div><p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks, \
this is pretty much provides the behaviour I want, however there is one oddity with \
it.   It allows me to successfully scroll past the last row, but at a certain point I \
will be able to move the scroll bar to the very end which causes the entire table to \
"snap" back to the bottom.   Did you find a way to avoid this?</span></p>


<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> \
</span></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Appreciate \
your help.</span></p>


<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> \
</span></p><p class="MsoNormal"><b><span lang="EN-US" \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span \
lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> \
Paul Du Bois [mailto:<a href="mailto:dubois@doublefine.com" \
target="_blank">dubois@doublefine.com</a>] <br>


<b>Sent:</b> August-28-13 4:34 PM<br><b>To:</b> Mark Mordeca<br><b>Cc:</b> <a \
href="mailto:pyqt@riverbankcomputing.com" \
target="_blank">pyqt@riverbankcomputing.com</a><br><b>Subject:</b> Re: [PyQt] Scroll \
QTableView beyond last column/row</span></p>


<p class="MsoNormal">  </p><div><div><p class="MsoNormal"><span \
style="color:#003300">I do this:</span></p></div><div><p class="MsoNormal"><span \
style="color:#003300">  </span></p></div><div><div><p class="MsoNormal"><span \
style="font-family:&quot;Courier New&quot;;color:#003300">            # somewhere in \
init</span></p>


</div><div><p class="MsoNormal"><span style="font-family:&quot;Courier \
New&quot;;color:#003300">            self._last_vsb_height = \
None</span></p></div><div><p class="MsoNormal"><span style="font-family:&quot;Courier \
New&quot;;color:#003300">            \
self.verticalScrollBar().rangeChanged[int,int].connect(self._on_range_changed)</span></p>



</div><div><p class="MsoNormal">  </p></div><div><p class="MsoNormal"><span \
style="font-family:&quot;Courier New&quot;;color:#003300">      def \
_on_range_changed(self, min, max):</span></p></div><div><p class="MsoNormal"><span \
style="font-family:&quot;Courier New&quot;;color:#003300">            # Try to \
prevent infinite recursion</span></p>


</div><div><p class="MsoNormal"><span style="font-family:&quot;Courier \
New&quot;;color:#003300">            # Count is in rows</span></p></div><div><p \
class="MsoNormal"><span style="font-family:&quot;Courier New&quot;;color:#003300">    \
if max != self._last_vsb_height:  </span></p>


</div><div><p class="MsoNormal"><span style="font-family:&quot;Courier \
New&quot;;color:#003300">                  sender = \
self.verticalScrollBar()</span></p></div><div><p class="MsoNormal"><span \
style="font-family:&quot;Courier New&quot;;color:#003300">                  \
self._last_vsb_height = max + 20</span></p>


</div><div><p class="MsoNormal"><span style="font-family:&quot;Courier \
New&quot;;color:#003300">                  sender.setRange(min, \
self._last_vsb_height)</span></p></div><div><p class="MsoNormal"><span \
style="color:#003300">  </span></p>


</div></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">  \
</p><div><p class="MsoNormal">On Wed, Aug 28, 2013 at 12:28 PM, Mark Mordeca &lt;<a \
href="mailto:mark.mordeca@prosensus.ca" \
target="_blank">mark.mordeca@prosensus.ca</a>&gt; wrote:</p>


<div><div><p class="MsoNormal">Greetings,</p><p class="MsoNormal">  </p><p \
class="MsoNormal">I have a simple QTableView connected to an QAbstractTableModel.   \
For the purposes of my question, let's assume that these are the most basic you can \
have in order to get a table with data in it.</p>


<p class="MsoNormal">  </p><p class="MsoNormal">Default behaviour is that you can \
scroll the table so that the last column/row becomes visible, but no further.   I \
would like to be able to scroll the table <i>past</i> the last row/column, i.e. I \
want to be able to continue to click right on the horizontal scroll bar even though I \
have reached the last column, thereby making the last column continue to shift left \
in the table revealing "empty space" in the TableView.   </p>


<p class="MsoNormal">  </p><p class="MsoNormal">I have been unsuccessful in trying to \
find a way and hoped that someone here had a way to do this or a suggestion as to \
how.</p><p class="MsoNormal">  </p><p class="MsoNormal">


Thank you,</p><p class="MsoNormal">Mark </p><p class="MsoNormal">  </p></div></div><p \
class="MsoNormal"><br>_______________________________________________<br>PyQt mailing \
list      <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">PyQt@riverbankcomputing.com</a><br>


<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></p></div><p \
class="MsoNormal">  </p></div></div></div> </blockquote></div><br></div>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://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