<?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 parent widget to child widget width]]></title><description><![CDATA[<p dir="auto">i have a dialog which has a child widget table view.<br />
some of table items are long, so when the table view is updated due to insertion of the item in model, the table resizes, because i have set this:<br />
<code>m_pTableView-&gt;horizontalHeader()-&gt;setSectionResizeMode(QHeaderView::ResizeToContents);</code>.</p>
<p dir="auto">but then my dialog (parent widget) doesn't resize itself so i get dialog with only part of the table widget visualized. i want to have the dialog also to be resized so i can have a complete view.</p>
<p dir="auto">what should i do?</p>
]]></description><link>https://forum.qt.io/topic/110807/resize-parent-widget-to-child-widget-width</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 23:34:24 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/110807.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Jan 2020 18:54:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to resize parent widget to child widget width on Mon, 20 Jan 2020 05:50:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
i did this after init but the dialog is now too narrow:</p>
<pre><code>	auto pViewport = m_pTableView-&gt;viewport();
	setFixedWidth(pViewport-&gt;width());
</code></pre>
]]></description><link>https://forum.qt.io/post/573155</link><guid isPermaLink="true">https://forum.qt.io/post/573155</guid><dc:creator><![CDATA[user4592357]]></dc:creator><pubDate>Mon, 20 Jan 2020 05:50:22 GMT</pubDate></item><item><title><![CDATA[Reply to resize parent widget to child widget width on Sun, 19 Jan 2020 20:40:26 GMT]]></title><description><![CDATA[<p dir="auto">See <a href="https://doc.qt.io/qt-5/qheaderview.html#setSectionResizeMode" target="_blank" rel="noopener noreferrer nofollow ugc">QHeaderView::setSectionResizeMode</a></p>
]]></description><link>https://forum.qt.io/post/573100</link><guid isPermaLink="true">https://forum.qt.io/post/573100</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 19 Jan 2020 20:40:26 GMT</pubDate></item><item><title><![CDATA[Reply to resize parent widget to child widget width on Sun, 19 Jan 2020 20:22:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
okay. i have two columns actually, one is for text which can be long, and one is for icon, fixed size. and dialog has ability to filter from table rows. so when i type text of small item, only that small item is shown, and the first column resizes to width of that text. how can i always keep the width of first column the width of longest text in model?</p>
]]></description><link>https://forum.qt.io/post/573095</link><guid isPermaLink="true">https://forum.qt.io/post/573095</guid><dc:creator><![CDATA[user4592357]]></dc:creator><pubDate>Sun, 19 Jan 2020 20:22:16 GMT</pubDate></item><item><title><![CDATA[Reply to resize parent widget to child widget width on Sun, 19 Jan 2020 20:12:44 GMT]]></title><description><![CDATA[<p dir="auto">So retrieve the viewport size and resize the dialog accordingly</p>
]]></description><link>https://forum.qt.io/post/573092</link><guid isPermaLink="true">https://forum.qt.io/post/573092</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 19 Jan 2020 20:12:44 GMT</pubDate></item><item><title><![CDATA[Reply to resize parent widget to child widget width on Sun, 19 Jan 2020 19:05:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
the dialog is initialized once, and user has to check items in it, so there's no more insertions after initialisation. so it'll be just one resize of the whole dialog.</p>
]]></description><link>https://forum.qt.io/post/573087</link><guid isPermaLink="true">https://forum.qt.io/post/573087</guid><dc:creator><![CDATA[user4592357]]></dc:creator><pubDate>Sun, 19 Jan 2020 19:05:10 GMT</pubDate></item><item><title><![CDATA[Reply to resize parent widget to child widget width on Sun, 19 Jan 2020 19:03:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/user4592357">@<bdi>user4592357</bdi></a> said in <a href="/post/573085">resize parent widget to child widget width</a>:</p>
<blockquote>
<p dir="auto">the table view and other items i  dialog are inserted in layout</p>
</blockquote>
<p dir="auto">So what do you want to achieve? Automatically resize the whole dialog? This would irritate the user I would guess.</p>
]]></description><link>https://forum.qt.io/post/573086</link><guid isPermaLink="true">https://forum.qt.io/post/573086</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 19 Jan 2020 19:03:39 GMT</pubDate></item><item><title><![CDATA[Reply to resize parent widget to child widget width on Sun, 19 Jan 2020 19:01:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
the table view and other items i  dialog are inserted in layout</p>
]]></description><link>https://forum.qt.io/post/573085</link><guid isPermaLink="true">https://forum.qt.io/post/573085</guid><dc:creator><![CDATA[user4592357]]></dc:creator><pubDate>Sun, 19 Jan 2020 19:01:15 GMT</pubDate></item><item><title><![CDATA[Reply to resize parent widget to child widget width on Sun, 19 Jan 2020 18:58:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/user4592357">@<bdi>user4592357</bdi></a> said in <a href="/post/573082">resize parent widget to child widget width</a>:</p>
<blockquote>
<p dir="auto">what should i do?</p>
</blockquote>
<p dir="auto">Add a proper layout to your dialog. See also <a href="https://doc.qt.io/qt-5/layout.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/layout.html</a></p>
]]></description><link>https://forum.qt.io/post/573083</link><guid isPermaLink="true">https://forum.qt.io/post/573083</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 19 Jan 2020 18:58:54 GMT</pubDate></item></channel></rss>