<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.Code, li.Code, div.Code
{mso-style-name:Code;
mso-style-priority:99;
mso-style-link:"Code Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:9.0pt;
font-family:"Courier New";}
span.CodeChar
{mso-style-name:"Code Char";
mso-style-priority:99;
mso-style-link:Code;
font-family:"Courier New";}
p.Reply, li.Reply, div.Reply
{mso-style-name:Reply;
mso-style-link:"Reply Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:#1F497D;}
span.ReplyChar
{mso-style-name:"Reply Char";
mso-style-link:Reply;
color:#1F497D;
mso-fareast-language:EN-CA;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang="EN-CA" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";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:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Appreciate your help.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Paul Du Bois [mailto:<a href="mailto:dubois@doublefine.com">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">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:"Courier New";color:#003300"> # somewhere in init</span></p>
</div><div><p class="MsoNormal"><span style="font-family:"Courier New";color:#003300"> self._last_vsb_height = None</span></p></div><div><p class="MsoNormal"><span style="font-family:"Courier New";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:"Courier New";color:#003300"> def _on_range_changed(self, min, max):</span></p></div><div><p class="MsoNormal"><span style="font-family:"Courier New";color:#003300"> # Try to prevent infinite recursion</span></p>
</div><div><p class="MsoNormal"><span style="font-family:"Courier New";color:#003300"> # Count is in rows</span></p></div><div><p class="MsoNormal"><span style="font-family:"Courier New";color:#003300"> if max != self._last_vsb_height: </span></p>
</div><div><p class="MsoNormal"><span style="font-family:"Courier New";color:#003300"> sender = self.verticalScrollBar()</span></p></div><div><p class="MsoNormal"><span style="font-family:"Courier New";color:#003300"> self._last_vsb_height = max + 20</span></p>
</div><div><p class="MsoNormal"><span style="font-family:"Courier New";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 <<a href="mailto:mark.mordeca@prosensus.ca" target="_blank">mark.mordeca@prosensus.ca</a>> wrote:</p>
<div><div><p class="MsoNormal" style>Greetings,</p><p class="MsoNormal" style> </p><p class="MsoNormal" style>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" style> </p><p class="MsoNormal" style>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" style> </p><p class="MsoNormal" style>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" style> </p><p class="MsoNormal" style>
Thank you,</p><p class="MsoNormal" style>Mark </p><p class="MsoNormal" style> </p></div></div><p class="MsoNormal"><br>_______________________________________________<br>PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">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></body></html>