<?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[set qhboxlayout to the bottom of the widget when i resize the window]]></title><description><![CDATA[<p dir="auto">i have a ui like this<img src="https://ddgobkiprc33d.cloudfront.net/a11ad402-6e7a-4798-8d35-89554161b702.png" alt="e9cf4eea-6b89-4509-ad76-27f41ffc43a2-image.png" class=" img-fluid img-markdown" /><br />
xml:</p>
<pre><code class="language-xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;ui version="4.0"&gt;
 &lt;class&gt;MainWindow&lt;/class&gt;
 &lt;widget class="QMainWindow" name="MainWindow"&gt;
  &lt;property name="geometry"&gt;
   &lt;rect&gt;
    &lt;x&gt;0&lt;/x&gt;
    &lt;y&gt;0&lt;/y&gt;
    &lt;width&gt;600&lt;/width&gt;
    &lt;height&gt;400&lt;/height&gt;
   &lt;/rect&gt;
  &lt;/property&gt;
  &lt;property name="minimumSize"&gt;
   &lt;size&gt;
    &lt;width&gt;600&lt;/width&gt;
    &lt;height&gt;400&lt;/height&gt;
   &lt;/size&gt;
  &lt;/property&gt;
  &lt;property name="windowTitle"&gt;
   &lt;string&gt;MainWindow&lt;/string&gt;
  &lt;/property&gt;
  &lt;widget class="QWidget" name="centralwidget"&gt;
   &lt;property name="sizePolicy"&gt;
    &lt;sizepolicy hsizetype="Preferred" vsizetype="Preferred"&gt;
     &lt;horstretch&gt;1&lt;/horstretch&gt;
     &lt;verstretch&gt;1&lt;/verstretch&gt;
    &lt;/sizepolicy&gt;
   &lt;/property&gt;
   &lt;widget class="QWidget" name="verticalLayoutWidget"&gt;
    &lt;property name="geometry"&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;350&lt;/y&gt;
      &lt;width&gt;602&lt;/width&gt;
      &lt;height&gt;51&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;layout class="QVBoxLayout" name="verticalLayout"&gt;
     &lt;item&gt;
      &lt;layout class="QHBoxLayout" name="horizontalLayout"&gt;
       &lt;item&gt;
        &lt;widget class="QPushButton" name="pushButton"&gt;
         &lt;property name="minimumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;40&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="maximumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;40&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="text"&gt;
          &lt;string&gt;&lt;-&lt;/string&gt;
         &lt;/property&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
       &lt;item&gt;
        &lt;widget class="QStackedWidget" name="stackedWidget"&gt;
         &lt;property name="minimumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;420&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="maximumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;16777215&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="currentIndex"&gt;
          &lt;number&gt;0&lt;/number&gt;
         &lt;/property&gt;
         &lt;widget class="QWidget" name="page"/&gt;
         &lt;widget class="QWidget" name="page_2"/&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
       &lt;item&gt;
        &lt;widget class="QLabel" name="count"&gt;
         &lt;property name="minimumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;50&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="maximumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;70&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="text"&gt;
          &lt;string&gt;time&lt;/string&gt;
         &lt;/property&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
       &lt;item&gt;
        &lt;widget class="QLabel" name="time"&gt;
         &lt;property name="minimumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;70&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="maximumSize"&gt;
          &lt;size&gt;
           &lt;width&gt;70&lt;/width&gt;
           &lt;height&gt;40&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
         &lt;property name="text"&gt;
          &lt;string&gt;time1&lt;/string&gt;
         &lt;/property&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
      &lt;/layout&gt;
     &lt;/item&gt;
    &lt;/layout&gt;
   &lt;/widget&gt;
  &lt;/widget&gt;
 &lt;/widget&gt;
 &lt;resources/&gt;
 &lt;connections/&gt;
&lt;/ui&gt;
</code></pre>
<p dir="auto">But how do I make qhboxlayout always stay at the bottom and stick to both sides of the gui even when I change the window size?</p>
]]></description><link>https://forum.qt.io/topic/154716/set-qhboxlayout-to-the-bottom-of-the-widget-when-i-resize-the-window</link><generator>RSS for Node</generator><lastBuildDate>Mon, 15 Jun 2026 23:20:54 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/154716.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Feb 2024 13:29:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to set qhboxlayout to the bottom of the widget when i resize the window on Tue, 20 Feb 2024 13:41:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/a_coder">@<bdi>a_coder</bdi></a><br />
Hi.  I believe you will find your design is not "correct", and I would start by getting that right.</p>
<p dir="auto">In the <strong>Object Inspector</strong> at the right you can see your <code>centralWidget</code> has a "red no-entry" sign on it.  That tells you it is a widget which needs to have a layout but lacks one.  I don't believe there is any (common) situation in which you want to leave it like that.</p>
<p dir="auto">You have placed a new <em>widget</em>, which has a vertical layout, directly onto <code>centralWidget</code>.  Instead you should have selected <code>centralWidget</code>, right-clicked on it, and used the bottom item on the menu there to set a vertical layout on the <code>centralWidget</code>.  There should be no "no-entry" sign then.  (Note that, irritatingly, <strong>Designer</strong> only allows you set a widget's layout <em>after</em> you have added at least one item onto it, not when it's empty.)  You can then place your <code>horizontalLayout</code> onto that.</p>
<p dir="auto">It's fiddly to remove content and then put it elsewhere in <strong>Designer</strong>, it's probably easier for you to delete/start over.</p>
<p dir="auto">I see others have posted while I have been composing this.  (Though I do not see any need for a <code>QGridLayout</code> here.)  Hopefully my post will help you sort that part out.</p>
]]></description><link>https://forum.qt.io/post/790675</link><guid isPermaLink="true">https://forum.qt.io/post/790675</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 20 Feb 2024 13:41:43 GMT</pubDate></item><item><title><![CDATA[Reply to set qhboxlayout to the bottom of the widget when i resize the window on Tue, 20 Feb 2024 14:24:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/a_coder">@<bdi>a_coder</bdi></a><br />
As both other responders said, you need a <em>vertical spacer</em> above a widget if you want to push it down.</p>
]]></description><link>https://forum.qt.io/post/790680</link><guid isPermaLink="true">https://forum.qt.io/post/790680</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 20 Feb 2024 14:24:47 GMT</pubDate></item><item><title><![CDATA[Reply to set qhboxlayout to the bottom of the widget when i resize the window on Tue, 20 Feb 2024 14:20:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> it's work now how can i keep it in the bottom when i resize it?</p>
]]></description><link>https://forum.qt.io/post/790679</link><guid isPermaLink="true">https://forum.qt.io/post/790679</guid><dc:creator><![CDATA[a_coder]]></dc:creator><pubDate>Tue, 20 Feb 2024 14:20:21 GMT</pubDate></item><item><title><![CDATA[Reply to set qhboxlayout to the bottom of the widget when i resize the window on Tue, 20 Feb 2024 13:41:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/a_coder">@<bdi>a_coder</bdi></a><br />
Hi.  I believe you will find your design is not "correct", and I would start by getting that right.</p>
<p dir="auto">In the <strong>Object Inspector</strong> at the right you can see your <code>centralWidget</code> has a "red no-entry" sign on it.  That tells you it is a widget which needs to have a layout but lacks one.  I don't believe there is any (common) situation in which you want to leave it like that.</p>
<p dir="auto">You have placed a new <em>widget</em>, which has a vertical layout, directly onto <code>centralWidget</code>.  Instead you should have selected <code>centralWidget</code>, right-clicked on it, and used the bottom item on the menu there to set a vertical layout on the <code>centralWidget</code>.  There should be no "no-entry" sign then.  (Note that, irritatingly, <strong>Designer</strong> only allows you set a widget's layout <em>after</em> you have added at least one item onto it, not when it's empty.)  You can then place your <code>horizontalLayout</code> onto that.</p>
<p dir="auto">It's fiddly to remove content and then put it elsewhere in <strong>Designer</strong>, it's probably easier for you to delete/start over.</p>
<p dir="auto">I see others have posted while I have been composing this.  (Though I do not see any need for a <code>QGridLayout</code> here.)  Hopefully my post will help you sort that part out.</p>
]]></description><link>https://forum.qt.io/post/790675</link><guid isPermaLink="true">https://forum.qt.io/post/790675</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 20 Feb 2024 13:41:43 GMT</pubDate></item><item><title><![CDATA[Reply to set qhboxlayout to the bottom of the widget when i resize the window on Tue, 20 Feb 2024 13:36:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/a_coder">@<bdi>a_coder</bdi></a> said in <a href="/post/790668">set qhboxlayout to the bottom of the widget when i resize the window</a>:</p>
<blockquote>
<p dir="auto">But how do I make qhboxlayout always stay at the bottom and stick to both sides of the gui even when I change the window size?</p>
</blockquote>
<p dir="auto">Don't add a new <code>verticalLayout</code> <strong>below</strong> <code>centralWidget</code>, but add a <code>verticalLayout</code> <strong>to</strong> your <code>centralWidget</code>.<br />
(you can tell from the red crossed circle sign next from <code>centralWidget</code> in Object Inspector)<br />
There are dozens of topics here on the forum on how to do it.</p>
<p dir="auto">Then, you need to a vertical spacer to push your bottom layout item in the <code>QVBoxLayout</code> (which is your <code>QHBoxLayout</code> and its content) down.</p>
]]></description><link>https://forum.qt.io/post/790672</link><guid isPermaLink="true">https://forum.qt.io/post/790672</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Tue, 20 Feb 2024 13:36:50 GMT</pubDate></item><item><title><![CDATA[Reply to set qhboxlayout to the bottom of the widget when i resize the window on Tue, 20 Feb 2024 13:34:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/a_coder">@<bdi>a_coder</bdi></a> it is simple:<br />
1 use gridlayout as the main layout<br />
2 in the grid layout, you can add an horizontal layout at the bottom then include your widgets<br />
3 to keep them at the bottom, add a vertical spacer in the grid layout at the top</p>
]]></description><link>https://forum.qt.io/post/790670</link><guid isPermaLink="true">https://forum.qt.io/post/790670</guid><dc:creator><![CDATA[Ronel_qtmaster]]></dc:creator><pubDate>Tue, 20 Feb 2024 13:34:58 GMT</pubDate></item></channel></rss>