<?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[Spacing and alignment of buttons in a QToolbar]]></title><description><![CDATA[<p dir="auto">I have added a buddy label and a <code>QSpinBox</code> to the toolbar of my main window which will zoom the contents of a <code>QTextBrowser</code>. This works OK.</p>
<p dir="auto">But by default, the toolbar has them all pushed over to the left. I would like to have some buttons on the left side of the toolbar and the zoom spin box over on the right.</p>
<p dir="auto">Is there any way to do this without having to call <code>setGeometry()</code> etc. myself on the controls? I believe there is an easy option to do this with a status bar, but not sure about how to do it with a toolbar. Or can I put them in a layout and add that to the toolbar? It's too bad that Qt Designer doesn't seem to allow doing it graphically.</p>
]]></description><link>https://forum.qt.io/topic/106900/spacing-and-alignment-of-buttons-in-a-qtoolbar</link><generator>RSS for Node</generator><lastBuildDate>Sat, 24 Oct 2026 13:56:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/106900.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Sep 2019 13:36:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Spacing and alignment of buttons in a QToolbar on Sun, 15 Sep 2019 15:39:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> Fantastic! You have saved me so much time ... thank you very much!</p>
]]></description><link>https://forum.qt.io/post/551193</link><guid isPermaLink="true">https://forum.qt.io/post/551193</guid><dc:creator><![CDATA[Robert Hairgrove]]></dc:creator><pubDate>Sun, 15 Sep 2019 15:39:53 GMT</pubDate></item><item><title><![CDATA[Reply to Spacing and alignment of buttons in a QToolbar on Sun, 15 Sep 2019 15:24:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
You cant do it Designer however, from code you can do<br />
the following</p>
<pre><code>  // add left Actions
    QAction *action1 = ui-&gt;toolBar-&gt;addAction("A1");

    // Spacer
    QWidget *spacer = new QWidget();
    spacer-&gt;setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    ui-&gt;toolBar-&gt;addWidget(spacer);

    // add right Actions
    QAction *action2 = ui-&gt;toolBar-&gt;addAction("A2");

</code></pre>
<p dir="auto"><img src="http://imagizer.imageshack.com/img922/4990/5AzvDd.png" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/551191</link><guid isPermaLink="true">https://forum.qt.io/post/551191</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sun, 15 Sep 2019 15:24:28 GMT</pubDate></item></channel></rss>