<div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small;color:rgb(0,0,0)">Here is the MRE. If you replace view.verticalHeader() with view.horizontalHeader(), the offset will be visible, but doing it with verticalHeader doesn't seem to affect the table view at all.<br><pre style="background-color:rgb(40,44,52);color:rgb(187,187,187);font-family:"Cascadia Code",monospace;font-size:10.5pt"><span style="color:rgb(213,95,222);font-style:italic">from </span>typing <span style="color:rgb(213,95,222);font-style:italic">import </span>Any, Optional<br><br><span style="color:rgb(213,95,222);font-style:italic">from </span>PyQt5 <span style="color:rgb(213,95,222);font-style:italic">import </span>QtCore<br><span style="color:rgb(213,95,222);font-style:italic">from </span>PyQt5.QtCore <span style="color:rgb(213,95,222);font-style:italic">import </span>Qt<br><span style="color:rgb(213,95,222);font-style:italic">from </span>PyQt5.QtWidgets <span style="color:rgb(213,95,222);font-style:italic">import </span>QMainWindow, QWidget, QHBoxLayout, QApplication, QTableView<br><br><br><span style="color:rgb(213,95,222);font-style:italic">class </span><span style="color:rgb(229,192,123)">Model</span><span style="color:rgb(209,154,102)">(</span>QtCore.QAbstractTableModel<span style="color:rgb(209,154,102)">)</span>:<br>    <span style="color:rgb(213,95,222);font-style:italic">def </span><span style="color:rgb(97,175,239)">__init__</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>, <span style="color:rgb(209,154,102)">parent</span>: <span style="color:rgb(229,192,123)">Optional[QWidget] </span>= <span style="color:rgb(213,95,222);font-style:italic">None</span><span style="color:rgb(209,154,102)">) </span>-> <span style="color:rgb(213,95,222);font-style:italic">None</span>:<br>        <span style="color:rgb(43,186,197)">super</span><span style="color:rgb(209,154,102)">(</span>Model, <span style="color:rgb(213,95,222);font-style:italic">self</span><span style="color:rgb(209,154,102)">)</span>.<span style="color:rgb(239,89,111)">__init__</span><span style="color:rgb(209,154,102)">(parent)<br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">self</span>.__data = <span style="color:rgb(209,154,102)">[]<br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">for </span>i <span style="color:rgb(213,95,222);font-style:italic">in </span><span style="color:rgb(43,186,197)">range</span><span style="color:rgb(209,154,102)">(10)</span>:<br>            row = <span style="color:rgb(209,154,102)">[0</span>, <span style="color:rgb(209,154,102)">1</span>, <span style="color:rgb(209,154,102)">2</span>, <span style="color:rgb(209,154,102)">3</span>, <span style="color:rgb(209,154,102)">4</span>, <span style="color:rgb(209,154,102)">5</span>, <span style="color:rgb(209,154,102)">6</span>, <span style="color:rgb(209,154,102)">7]<br></span><span style="color:rgb(209,154,102)">            </span><span style="color:rgb(213,95,222);font-style:italic">self</span>.__data.<span style="color:rgb(97,175,239)">append</span><span style="color:rgb(209,154,102)">(</span>row<span style="color:rgb(209,154,102)">)<br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(209,154,102)">    </span><span style="color:rgb(213,95,222);font-style:italic">def </span><span style="color:rgb(97,175,239)">rowCount</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>, <span style="color:rgb(209,154,102)">index</span>: <span style="color:rgb(229,192,123)">Optional[QtCore.QModelIndex] </span>= <span style="color:rgb(213,95,222);font-style:italic">None</span><span style="color:rgb(209,154,102)">) </span>-> <span style="color:rgb(43,186,197)">int</span>:<br>        <span style="color:rgb(213,95,222);font-style:italic">return </span><span style="color:rgb(43,186,197)">len</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>.__data<span style="color:rgb(209,154,102)">)<br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(209,154,102)">    </span><span style="color:rgb(213,95,222);font-style:italic">def </span><span style="color:rgb(97,175,239)">columnCount</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>, <span style="color:rgb(209,154,102)">index</span>: <span style="color:rgb(229,192,123)">Optional[QtCore.QModelIndex] </span>= <span style="color:rgb(213,95,222);font-style:italic">None</span><span style="color:rgb(209,154,102)">) </span>-> <span style="color:rgb(43,186,197)">int</span>:<br>        <span style="color:rgb(213,95,222);font-style:italic">return </span><span style="color:rgb(43,186,197)">len</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>.__data<span style="color:rgb(209,154,102)">[0])<br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(209,154,102)">    </span><span style="color:rgb(213,95,222);font-style:italic">def </span><span style="color:rgb(97,175,239)">data</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>, <span style="color:rgb(209,154,102)">index</span>: <span style="color:rgb(229,192,123)">QtCore.QModelIndex</span>,<br>             <span style="color:rgb(209,154,102)">role</span>: <span style="color:rgb(229,192,123)">QtCore.Qt.ItemDataRole </span>= Qt.ItemDataRole.DisplayRole<span style="color:rgb(209,154,102)">) </span>-> <span style="color:rgb(229,192,123)">Any</span>:<br>        <span style="color:rgb(213,95,222);font-style:italic">if </span><span style="color:rgb(209,154,102)">role </span><span style="color:rgb(213,95,222);font-style:italic">in </span><span style="color:rgb(209,154,102)">[</span>Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole<span style="color:rgb(209,154,102)">]</span>:<br>            <span style="color:rgb(213,95,222);font-style:italic">return self</span>.__data<span style="color:rgb(209,154,102)">[index</span>.<span style="color:rgb(97,175,239)">row</span><span style="color:rgb(209,154,102)">()][index</span>.<span style="color:rgb(97,175,239)">column</span><span style="color:rgb(209,154,102)">()]<br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">return None<br></span><span style="color:rgb(213,95,222);font-style:italic"><br></span><span style="color:rgb(213,95,222);font-style:italic"><br></span><span style="color:rgb(213,95,222);font-style:italic">class </span><span style="color:rgb(229,192,123)">MainWindow</span><span style="color:rgb(209,154,102)">(</span>QMainWindow<span style="color:rgb(209,154,102)">)</span>:<br>    <span style="color:rgb(213,95,222);font-style:italic">def </span><span style="color:rgb(97,175,239)">__init__</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span><span style="color:rgb(209,154,102)">)</span>:<br>        <span style="color:rgb(43,186,197)">super</span><span style="color:rgb(209,154,102)">()</span>.<span style="color:rgb(97,175,239)">__init__</span><span style="color:rgb(209,154,102)">()<br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">self</span>.<span style="color:rgb(97,175,239)">resize</span><span style="color:rgb(209,154,102)">(700</span>, <span style="color:rgb(209,154,102)">700)<br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">self</span>.central_widget = <span style="color:rgb(97,175,239)">QWidget</span><span style="color:rgb(209,154,102)">()<br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">self</span>.central_widget_layout = <span style="color:rgb(97,175,239)">QHBoxLayout</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>.central_widget<span style="color:rgb(209,154,102)">)<br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(209,154,102)">        </span>view = <span style="color:rgb(97,175,239)">QTableView</span><span style="color:rgb(209,154,102)">()<br></span><span style="color:rgb(209,154,102)">        </span>model = <span style="color:rgb(97,175,239)">Model</span><span style="color:rgb(209,154,102)">()<br></span><span style="color:rgb(209,154,102)">        </span>view.<span style="color:rgb(97,175,239)">setModel</span><span style="color:rgb(209,154,102)">(</span>model<span style="color:rgb(209,154,102)">)<br></span><span style="color:rgb(209,154,102)">        </span>view.<span style="color:rgb(97,175,239)">verticalHeader</span><span style="color:rgb(209,154,102)">()</span>.<span style="color:rgb(97,175,239)">setOffset</span><span style="color:rgb(209,154,102)">(</span>-<span style="color:rgb(209,154,102)">40)<br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">self</span>.central_widget_layout.<span style="color:rgb(97,175,239)">addWidget</span><span style="color:rgb(209,154,102)">(</span>view<span style="color:rgb(209,154,102)">)<br></span><span style="color:rgb(209,154,102)">        </span><span style="color:rgb(213,95,222);font-style:italic">self</span>.<span style="color:rgb(97,175,239)">setCentralWidget</span><span style="color:rgb(209,154,102)">(</span><span style="color:rgb(213,95,222);font-style:italic">self</span>.central_widget<span style="color:rgb(209,154,102)">)<br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(209,154,102)"><br></span><span style="color:rgb(213,95,222);font-style:italic">if </span>__name__ == <span style="color:rgb(137,202,120)">"__main__"</span>:<br>    app = <span style="color:rgb(97,175,239)">QApplication</span><span style="color:rgb(209,154,102)">(</span>sys.argv<span style="color:rgb(209,154,102)">)<br></span><span style="color:rgb(209,154,102)">    </span>mw = <span style="color:rgb(97,175,239)">MainWindow</span><span style="color:rgb(209,154,102)">()<br></span><span style="color:rgb(209,154,102)">    </span>mw.<span style="color:rgb(97,175,239)">show</span><span style="color:rgb(209,154,102)">()<br></span><span style="color:rgb(209,154,102)">    </span>sys.<span style="color:rgb(97,175,239)">exit</span><span style="color:rgb(209,154,102)">(</span>app.<span style="color:rgb(97,175,239)">exec</span><span style="color:rgb(209,154,102)">())</span></pre></div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid #d3d4de">
        <tr>
        <td style="width:55px;padding-top:13px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
                <td style="width:470px;padding-top:12px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link" target="_blank" style="color:#4453ea">www.avast.com</a>
                </td>
        </tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 20, 2022 at 4:54 PM Maurizio Berti <<a href="mailto:maurizio.berti@gmail.com">maurizio.berti@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Can you provide a MRE to show how you tried to set the offset?<br></div><div>Remember that the offset of headers is always updated whenever *any* change would result in a call to updateGeometries() (model size/layout changes), and, obviously, whenever scroll bars are updated (value/range change), including changes caused by the view receiving a resize event.</div><div><br></div><div>Maurizio<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno dom 20 mar 2022 alle ore 14:13 Matej Brezović <<a href="mailto:matey.brezovic@gmail.com" target="_blank">matey.brezovic@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small;color:rgb(0,0,0)">Tried setting offset for verticalHeader of QTableView in both PyQt5 (5.15.2) and PyQt6 (6.2.2), it doesn't do anything. Works for horizontal headers but not for vertical ones. </div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small;color:rgb(0,0,0)">I can't confirm if this is a problem just with PyQt or with Qt as well because I don't use C++. </div></div><div id="gmail-m_379014115603901552gmail-m_6015398719878155313DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid rgb(211,212,222)">
        <tbody><tr>
        <td style="width:55px;padding-top:13px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" style="width: 46px; height: 29px;" width="46" height="29"></a></td>
                <td style="width:470px;padding-top:12px;color:rgb(65,66,78);font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link" style="color:rgb(68,83,234)" target="_blank">www.avast.com</a>
                </td>
        </tr>
</tbody></table><a href="#m_379014115603901552_m_6015398719878155313_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr">È 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>