<?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[Resize the &quot;setGeometry&quot; from cpp]]></title><description><![CDATA[<p dir="auto">Hai everyone. I want to resize my widget by its geometry. This is the code</p>
<pre><code>void MainGUI::resizeEvent(QResizeEvent *e)
{
	heightsize = e-&gt;size().height();
	float spacing = heightsize/700.0;

	QWidget * channel = new QWidget(this);
	channelFrame * cF = new channelFrame(channel);
	cF-&gt;setGeometry(10, 40 + ( 75 * spacing), 1115, 35);
	cF-&gt;show();
}
</code></pre>
<p dir="auto">But it also add the widget, not resizing it. how can I only resize the spacing? Sorry I'm a newbie here</p>
]]></description><link>https://forum.qt.io/topic/131328/resize-the-setgeometry-from-cpp</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 12:44:07 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/131328.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Oct 2021 06:38:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Resize the &quot;setGeometry&quot; from cpp on Tue, 26 Oct 2021 13:14:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisw67">@<bdi>ChrisW67</bdi></a> I'm using another method, I'm not reccommend this method because its for newbie like me. hehe. So I build one per one of channel frame like this...<br />
<img src="https://ddgobkiprc33d.cloudfront.net/581a8a10-1c1e-4eba-8d36-df239c55aa01.png" alt="81e093f8-de90-48b3-bce0-2f4238d2d423-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I think it solved but I have to make more codes for this methods</p>
]]></description><link>https://forum.qt.io/post/686842</link><guid isPermaLink="true">https://forum.qt.io/post/686842</guid><dc:creator><![CDATA[mimamrafi]]></dc:creator><pubDate>Tue, 26 Oct 2021 13:14:14 GMT</pubDate></item><item><title><![CDATA[Reply to Resize the &quot;setGeometry&quot; from cpp on Fri, 22 Oct 2021 22:39:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mimamrafi">@<bdi>mimamrafi</bdi></a>  Can you confirm that you want the individual sub-widgets (i.e. the Off, +, -  buttons, sliders etc.) to stay exactly the same size and only the space between them to grow if the total available space grows?</p>
<p dir="auto">Can you post the UI file that you seem to have for your channelFrame?</p>
]]></description><link>https://forum.qt.io/post/686319</link><guid isPermaLink="true">https://forum.qt.io/post/686319</guid><dc:creator><![CDATA[ChrisW67]]></dc:creator><pubDate>Fri, 22 Oct 2021 22:39:58 GMT</pubDate></item><item><title><![CDATA[Reply to Resize the &quot;setGeometry&quot; from cpp on Fri, 22 Oct 2021 09:08:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mimamrafi">@<bdi>mimamrafi</bdi></a><br />
It's difficult to answer your questions.  You need a basic understanding of Qt and widgets, which seems to be lacking.</p>
<blockquote>
<p dir="auto">How to update my widget? How to avoid "new" QWidget?</p>
</blockquote>
<p dir="auto">Do whatever on your existing widget, don't create a new one.  Can't answer any clearer than that.</p>
<blockquote>
<p dir="auto">I know there's layout feature, but in my case I have to make it dynamic from cpp</p>
</blockquote>
<p dir="auto"><code>QLayout</code>s can be created from C++ code, not just from e.g. Qt Designer/<code>.ui</code> file.  You should be doing <em>all</em> of your desired layout via suitable <code>QLayout</code>s, not <code>setGeomtetry()</code> or any coordinate positioning of widgets, as <a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisw67">@<bdi>ChrisW67</bdi></a> indicated.  Your case <em>looks like</em> a <code>QGridLayout</code>.</p>
]]></description><link>https://forum.qt.io/post/686203</link><guid isPermaLink="true">https://forum.qt.io/post/686203</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 22 Oct 2021 09:08:08 GMT</pubDate></item><item><title><![CDATA[Reply to Resize the &quot;setGeometry&quot; from cpp on Fri, 22 Oct 2021 08:30:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisw67">@<bdi>ChrisW67</bdi></a> I know there's layout feature, but in my case I have to make it dynamic from cpp</p>
]]></description><link>https://forum.qt.io/post/686198</link><guid isPermaLink="true">https://forum.qt.io/post/686198</guid><dc:creator><![CDATA[mimamrafi]]></dc:creator><pubDate>Fri, 22 Oct 2021 08:30:27 GMT</pubDate></item><item><title><![CDATA[Reply to Resize the &quot;setGeometry&quot; from cpp on Fri, 22 Oct 2021 08:20:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> the channelFrame is a class that contain many widget.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/cf6045c4-47f3-40a4-8435-dcfddca7bafa.png" alt="ebbfc997-23c8-423c-96f7-27d335997bcc-image.png" class=" img-fluid img-markdown" /><br />
this is the channelframe.ui and I created it repeatedly. Like this<br />
<img src="https://ddgobkiprc33d.cloudfront.net/40d06a45-2669-44b0-bd7b-a80038c96529.png" alt="31eb2e3b-f3ee-4a72-96c1-5ab65a377c1d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">And I want the channelSpacing more wider when size changed to be like this<br />
<img src="https://ddgobkiprc33d.cloudfront.net/ff3c63ee-c406-458b-9036-0fcc5bbb9cc5.png" alt="e644eaaf-a573-44e0-bb38-c9a6b56f1406-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">You are right it cannot be solved because I just create new widget again. How to update my widget? How to avoid "new" QWidget? i'm so sorry this is my senior code and I'm newbie in QT</p>
]]></description><link>https://forum.qt.io/post/686196</link><guid isPermaLink="true">https://forum.qt.io/post/686196</guid><dc:creator><![CDATA[mimamrafi]]></dc:creator><pubDate>Fri, 22 Oct 2021 08:20:03 GMT</pubDate></item><item><title><![CDATA[Reply to Resize the &quot;setGeometry&quot; from cpp on Fri, 22 Oct 2021 07:23:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mimamrafi">@<bdi>mimamrafi</bdi></a>  In Qt, if you are manually resizing widgets inside other widgets then you are usually  going about your UI the wrong way.  Qt has a <a href="https://doc.qt.io/qt-5/layout.html" target="_blank" rel="noopener noreferrer nofollow ugc">layout system</a> to arrange contained widgets and this is almost always a set-and-forget problem.</p>
]]></description><link>https://forum.qt.io/post/686174</link><guid isPermaLink="true">https://forum.qt.io/post/686174</guid><dc:creator><![CDATA[ChrisW67]]></dc:creator><pubDate>Fri, 22 Oct 2021 07:23:00 GMT</pubDate></item><item><title><![CDATA[Reply to Resize the &quot;setGeometry&quot; from cpp on Fri, 22 Oct 2021 07:17:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mimamrafi">@<bdi>mimamrafi</bdi></a><br />
Hello and welcome.</p>
<blockquote>
<p dir="auto">But it also add the widget</p>
</blockquote>
<p dir="auto">You go <code>QWidget * channel = new QWidget(this);</code>, so, yes, that creates and adds a new widget.</p>
<p dir="auto">We don't know what your <code>new channelFrame(channel)</code> is.</p>
<blockquote>
<p dir="auto">I want to resize my widget</p>
</blockquote>
<p dir="auto">What widget?  Some existing one??  The newly created <code>channel</code> one?  The newly created <code>channelFrame</code>, which we don't even know whether it is a widget?</p>
]]></description><link>https://forum.qt.io/post/686172</link><guid isPermaLink="true">https://forum.qt.io/post/686172</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 22 Oct 2021 07:17:53 GMT</pubDate></item></channel></rss>