<?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[Why plus 1 when getting the content height of QTextEdit?]]></title><description><![CDATA[<p dir="auto">Why plus 1 when getting the content height of QTextEdit?<br />
c++</p>
<pre><code>QMargins margins = textEdit-&gt;contentsMargins();
QSizeF documentSize =  textEdit-&gt;document()-&gt;size();
int height = documentSize.height() + margins.top() + margins.bottom() + 1;
</code></pre>
<p dir="auto">python</p>
<pre><code>margins = self.textEdit.contentsMargins()
size = self.textEdit.document().size()
height = size.height() + margins.top() + margins.bottom() + 1
</code></pre>
<p dir="auto"><a href="https://forum.qt.io/topic/87934/set-exact-height-for-qplaintextedit-according-to-height/3">https://forum.qt.io/topic/87934/set-exact-height-for-qplaintextedit-according-to-height/3</a></p>
]]></description><link>https://forum.qt.io/topic/114402/why-plus-1-when-getting-the-content-height-of-qtextedit</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Nov 2026 10:24:45 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/114402.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 May 2020 07:11:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Why plus 1 when getting the content height of QTextEdit? on Tue, 05 May 2020 06:32:47 GMT]]></title><description><![CDATA[<p dir="auto">Did you read the last post of the thread ? It contains two links: one points to a Qt bug report where the logic is explained and another one that points to the QPlainTextEdit documentation.</p>
]]></description><link>https://forum.qt.io/post/592634</link><guid isPermaLink="true">https://forum.qt.io/post/592634</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 05 May 2020 06:32:47 GMT</pubDate></item><item><title><![CDATA[Reply to Why plus 1 when getting the content height of QTextEdit? on Tue, 05 May 2020 06:29:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a>  But I can't find answer. Is my question too vague? I don't know why need plus 1, +1</p>
]]></description><link>https://forum.qt.io/post/592631</link><guid isPermaLink="true">https://forum.qt.io/post/592631</guid><dc:creator><![CDATA[ideaplus]]></dc:creator><pubDate>Tue, 05 May 2020 06:29:41 GMT</pubDate></item><item><title><![CDATA[Reply to Why plus 1 when getting the content height of QTextEdit? on Mon, 04 May 2020 18:10:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">You have the <a href="https://forum.qt.io/topic/87934/set-exact-height-for-qplaintextedit-according-to-height/9">answer in the same thread you are linking to</a>.</p>
]]></description><link>https://forum.qt.io/post/592538</link><guid isPermaLink="true">https://forum.qt.io/post/592538</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 04 May 2020 18:10:58 GMT</pubDate></item></channel></rss>