<?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[[SOLVED] Problem with mainLayout of Dialog.]]></title><description><![CDATA[<p dir="auto">I have a problem with the mainLayout. I have this:</p>
<p dir="auto">@ optionsGroupBox = new QGroupBox();<br />
optionsGroupBoxLayout = new QGridLayout;<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;label, 0,0);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;comboBox, 0,1);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;label_2, 1,0);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;lineEdit, 1,1);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;label_3, 2,0);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;lineEdit_2, 2,1);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;pushButton_3, 2,2);</p>
<pre><code>optionsGroupBox-&gt;setLayout(optionsGroupBoxLayout);

buttonsLayout = new QHBoxLayout;
buttonsLayout-&gt;addStretch();
buttonsLayout-&gt;addWidget(ui-&gt;pushButton_2);
buttonsLayout-&gt;addWidget(ui-&gt;pushButton);

mainLayout = new QVBoxLayout;
mainLayout-&gt;addWidget(optionsGroupBox);
mainLayout-&gt;addLayout(buttonsLayout);
setLayout(mainLayout);@
</code></pre>
<p dir="auto">and it looks like:<br />
!<a href="http://img683.imageshack.us/img683/4044/screenshotsaywhat.png(screen)" target="_blank" rel="noopener noreferrer nofollow ugc">http://img683.imageshack.us/img683/4044/screenshotsaywhat.png(screen)</a>!<br />
but i want it look like:<br />
!<a href="http://img836.imageshack.us/img836/7202/screenshot1flw.png(screen2)" target="_blank" rel="noopener noreferrer nofollow ugc">http://img836.imageshack.us/img836/7202/screenshot1flw.png(screen2)</a>!</p>
<p dir="auto">So the question<br />
What about the space up from the button Browze.. How can it be covered from the above linedit? ( See second screenshot )<br />
Thanks for any answers :)</p>
<p dir="auto">P.S When i say the space up from the button Browze i mean:<br />
!<a href="http://img11.imageshack.us/img11/4044/screenshotsaywhat.png(screen3)" target="_blank" rel="noopener noreferrer nofollow ugc">http://img11.imageshack.us/img11/4044/screenshotsaywhat.png(screen3)</a>!</p>
]]></description><link>https://forum.qt.io/topic/9273/solved-problem-with-mainlayout-of-dialog</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Mar 2026 09:18:57 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/9273.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Sep 2011 17:06:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] Problem with mainLayout of Dialog. on Thu, 08 Sep 2011 14:24:09 GMT]]></title><description><![CDATA[<p dir="auto">On a side-note. The word is "Browse", not "Browze". You also might want to check if you really want to say "Nami".</p>
]]></description><link>https://forum.qt.io/post/108470</link><guid isPermaLink="true">https://forum.qt.io/post/108470</guid><dc:creator><![CDATA[andre]]></dc:creator><pubDate>Thu, 08 Sep 2011 14:24:09 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] Problem with mainLayout of Dialog. on Thu, 08 Sep 2011 14:01:14 GMT]]></title><description><![CDATA[<p dir="auto">I don't know why, but I <em>always</em> do that! It's like a mini brain rebellion over which I have no control :D</p>
]]></description><link>https://forum.qt.io/post/108467</link><guid isPermaLink="true">https://forum.qt.io/post/108467</guid><dc:creator><![CDATA[goblincoding]]></dc:creator><pubDate>Thu, 08 Sep 2011 14:01:14 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] Problem with mainLayout of Dialog. on Wed, 07 Sep 2011 19:52:43 GMT]]></title><description><![CDATA[<p dir="auto">k the first answer is ok! :D<br />
Just not    -QVBoxLayout- lineAndBrowseLayout = new -QVBoxLayout-;<br />
but   lineAndBrowseLayout = new QHBoxLayout<br />
will do what i want.. thanks ;)</p>
]]></description><link>https://forum.qt.io/post/108376</link><guid isPermaLink="true">https://forum.qt.io/post/108376</guid><dc:creator><![CDATA[Leon]]></dc:creator><pubDate>Wed, 07 Sep 2011 19:52:43 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] Problem with mainLayout of Dialog. on Wed, 07 Sep 2011 18:33:22 GMT]]></title><description><![CDATA[<p dir="auto">There is a QGridLayout::addWidget() overload which takes a <em>rowSpan</em> and a <em>columnSpan</em> too.<br />
@<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;comboBox, 0,1,1,2);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;lineEdit, 1,1,1,2);<br />
@<br />
Will do the trick.</p>
]]></description><link>https://forum.qt.io/post/108361</link><guid isPermaLink="true">https://forum.qt.io/post/108361</guid><dc:creator><![CDATA[lgeyer]]></dc:creator><pubDate>Wed, 07 Sep 2011 18:33:22 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] Problem with mainLayout of Dialog. on Wed, 07 Sep 2011 17:29:32 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Leon" date="1315415173"]I have a problem with the mainLayout. I have this:</p>
<p dir="auto">@ optionsGroupBox = new QGroupBox();<br />
optionsGroupBoxLayout = new QGridLayout;<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;label, 0,0);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;comboBox, 0,1);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;label_2, 1,0);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;lineEdit, 1,1);<br />
optionsGroupBoxLayout-&gt;addWidget(ui-&gt;label_3, 2,0);</p>
<pre><code>//add an additional layout for the Browse button and second line edit
QVBoxLayout lineAndBrowseLayout = new QVBoxLayout;
lineAndBrowseLayout-&gt;addWidget(ui-&gt;lineEdit_2);
lineAndBrowseLayout-&gt;addWidget(ui-&gt;pushButton_3);
optionsGroupBoxLayout-&gt;addLayout(lineAndBrowseLayout, 2,1);*

optionsGroupBox-&gt;setLayout(optionsGroupBoxLayout);

buttonsLayout = new QHBoxLayout;
buttonsLayout-&gt;addStretch();
buttonsLayout-&gt;addWidget(ui-&gt;pushButton_2);
buttonsLayout-&gt;addWidget(ui-&gt;pushButton);

mainLayout = new QVBoxLayout;
mainLayout-&gt;addWidget(optionsGroupBox);
mainLayout-&gt;addLayout(buttonsLayout);
setLayout(mainLayout);@
</code></pre>
<p dir="auto">[/quote]<br />
The bit I added above should do the trick.  Note, however, that the space available to position (2,1) in the grid (where we're adding the new layout) will be divided equally between the line edit and the Browse button, i.e. they'll be the same size.  You may have to play around with constraints a bit to get your ratio of QLineEdit::QPushButton space usage just right.</p>
]]></description><link>https://forum.qt.io/post/108354</link><guid isPermaLink="true">https://forum.qt.io/post/108354</guid><dc:creator><![CDATA[goblincoding]]></dc:creator><pubDate>Wed, 07 Sep 2011 17:29:32 GMT</pubDate></item></channel></rss>