<?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[QGroupBox and positioning a button on a QGroupBox]]></title><description><![CDATA[<p dir="auto">Hello all,<br />
I am creating a QGroupBox on my QMainWindow window.</p>
<pre><code>QGroupBox		*GROUPBOXChemicalEquation;
GROUPBOXChemicalEquation=new QGroupBox(this);
GROUPBOXChemicalEquation-&gt;setGeometry(X, Y, width, height);
GROUPBOXChemicalEquation-&gt;setTitle("Chemical Equation");

</code></pre>
<p dir="auto">So, that looks fine and good.<br />
Then I want to place some controls on it. Let’s say, I want to put this button:</p>
<pre><code>BUTTONCopyEnergy3=new QPushButton(“Copy”, GROUPBOXChemicalEquation); &lt;====notice the  GROUPBOXChemicalEquation
BUTTONCopyEnergy3-&gt;setGeometry(0, 0, BUTTONCopyEnergy3PosSize[2], BUTTONCopyEnergy3PosSize[3]);
</code></pre>
<p dir="auto">THE PROBLEM:<br />
The problem is the position of the button. It positions the button over the header text: Chemical Equation<img src="https://ddgobkiprc33d.cloudfront.net/01280605-47a9-47c2-9fa8-cc1fbeb79ef3.png" alt="zzzBug.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/139232/qgroupbox-and-positioning-a-button-on-a-qgroupbox</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Nov 2026 14:40:49 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139232.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 11 Sep 2022 13:49:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QGroupBox and positioning a button on a QGroupBox on Sun, 11 Sep 2022 17:51:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stretchthebits">@<bdi>stretchthebits</bdi></a> said in <a href="/post/728232">QGroupBox and positioning a button on a QGroupBox</a>:</p>
<blockquote>
<p dir="auto">And why not calculate and position controls ourselves?</p>
</blockquote>
<p dir="auto">You can if you want to do all the calculations by yourself. But this is not trivial and what's the layout manager is for.</p>
]]></description><link>https://forum.qt.io/post/728234</link><guid isPermaLink="true">https://forum.qt.io/post/728234</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 11 Sep 2022 17:51:06 GMT</pubDate></item><item><title><![CDATA[Reply to QGroupBox and positioning a button on a QGroupBox on Sun, 11 Sep 2022 17:24:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> That seems to be fine for a simple arrangement but I am not sure how to have the look as can been in the screenshot.<br />
And why not calculate and position controls ourselves?</p>
]]></description><link>https://forum.qt.io/post/728232</link><guid isPermaLink="true">https://forum.qt.io/post/728232</guid><dc:creator><![CDATA[stretchthebits]]></dc:creator><pubDate>Sun, 11 Sep 2022 17:24:58 GMT</pubDate></item><item><title><![CDATA[Reply to QGroupBox and positioning a button on a QGroupBox on Sun, 11 Sep 2022 14:43:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stretchthebits">@<bdi>stretchthebits</bdi></a><br />
As ever, you are supposed to place a layout and not use absolute size/positioning to place widgets on boxes.  Have you looked at the basic example at <a href="https://doc.qt.io/qt-5/qgroupbox.html#details" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qgroupbox.html#details</a> ?</p>
]]></description><link>https://forum.qt.io/post/728218</link><guid isPermaLink="true">https://forum.qt.io/post/728218</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Sun, 11 Sep 2022 14:43:02 GMT</pubDate></item></channel></rss>