<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to tune precisely the height of a QTableWidget according to header &amp; row heights]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I would like to tune dynamically and in a cross platform compatible way the height of a QTableWidget so that:</p>
<ul>
<li>No row is "cut" at the bottom of the table and scrolling is smooth (row separators do not move while scrolling).</li>
<li>Last row bottom separator in the table matches exactly table bottom boundary.</li>
<li>No scrollbar appears if the table has a number of rows that can fit precisely within the height of the table.</li>
</ul>
<p dir="auto">Assuming all rows have the same height, I thought a simple computation based on</p>
<ul>
<li>Header height: table.horizontalHeader().height().</li>
<li>Plus a wished visible number of rows multiplied by table.rowHeight(0).</li>
</ul>
<p dir="auto">would make it, but I need for example on Windows to add 4 more pixels to that result to get the behavior I want, and on other platforms this is different. And sometimes it is even dependent on some OS setup.</p>
<p dir="auto">Would you have any hints to compute the exact table height I need in a clean &amp; cross-platform way?</p>
<p dir="auto">Thanks a lot for your help.</p>
]]></description><link>https://forum.qt.io/topic/141821/how-to-tune-precisely-the-height-of-a-qtablewidget-according-to-header-row-heights</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 19:40:45 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/141821.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Dec 2022 17:23:43 GMT</pubDate><ttl>60</ttl></channel></rss>