<?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[Class to add a footer to the QTabWidget widgets]]></title><description><![CDATA[<p dir="auto">Hi there,<br />
I have a QTabWidget that contains 3 tabs. Each tab contains a custom QWidget, let's call them tabA, tabB and tabC. Each custom QWidget does something that is really different from the others.</p>
<p dir="auto">I want to add the same footer to all the custom QWidgets.</p>
<p dir="auto">I tried something like</p>
<pre><code>m_tab_footer = new TabFooter(this);
qobject_cast&lt;tabA*&gt;(ui-&gt;text_area-&gt;widget(0))-&gt;setTabFooter(m_tab_footer);
qobject_cast&lt;tabB*&gt;(ui-&gt;text_area-&gt;widget(1))-&gt;setTabFooter(m_tab_footer);
qobject_cast&lt;tabC*&gt;(ui-&gt;text_area-&gt;widget(2))-&gt;setTabFooter(m_tab_footer);
</code></pre>
<p dir="auto">with setTabFooter defined as</p>
<pre><code>void tabA::setTabFooter(TabFooter* footer) {
   ui-&gt;layout_footer-&gt;addWidget(footer);
}
</code></pre>
<p dir="auto">tabA, tabB and tabC are set for each tab of the QTabWidget in QtDesigner.</p>
<p dir="auto">Unfortunately, there are several problem. First it is highly redundant and I guess it is possible to factorize. Secondly, it does not work because the footer only appears on the tabC widget, probably because the <em>layout_footer</em> takes the ownership of the TabFooter object.</p>
<p dir="auto">I guess tabA, tabB and tabC should inherit from a common class that would contain the FooterTab object. Yet, I do not know (probably too tired now) how to integrate the current tabA/tabB/tabC content into this common class.</p>
<p dir="auto">Thanks for your help.</p>
]]></description><link>https://forum.qt.io/topic/146072/class-to-add-a-footer-to-the-qtabwidget-widgets</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 07:00:53 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146072.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 28 Jun 2023 13:10:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Class to add a footer to the QTabWidget widgets on Wed, 28 Jun 2023 13:16:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/odelaune">@<bdi>odelaune</bdi></a> Simply put your QTabWidget and and the TabFooter in same vertical layout...<br />
Also, you CAN'T use same widget instance in more than one place like you're trying right now. That is why it is only visible on tabC.</p>
]]></description><link>https://forum.qt.io/post/762897</link><guid isPermaLink="true">https://forum.qt.io/post/762897</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 28 Jun 2023 13:16:45 GMT</pubDate></item><item><title><![CDATA[Reply to Class to add a footer to the QTabWidget widgets on Wed, 28 Jun 2023 13:19:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said in <a href="/post/762897">Class to add a footer to the QTabWidget widgets</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/odelaune">@<bdi>odelaune</bdi></a> Simply put your QTabWidget and and the TabFooter in same vertical layout...</p>
</blockquote>
<p dir="auto">Oh, yes of course.<br />
Thank you.</p>
]]></description><link>https://forum.qt.io/post/762900</link><guid isPermaLink="true">https://forum.qt.io/post/762900</guid><dc:creator><![CDATA[odelaune]]></dc:creator><pubDate>Wed, 28 Jun 2023 13:19:43 GMT</pubDate></item><item><title><![CDATA[Reply to Class to add a footer to the QTabWidget widgets on Wed, 28 Jun 2023 13:16:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/odelaune">@<bdi>odelaune</bdi></a> Simply put your QTabWidget and and the TabFooter in same vertical layout...<br />
Also, you CAN'T use same widget instance in more than one place like you're trying right now. That is why it is only visible on tabC.</p>
]]></description><link>https://forum.qt.io/post/762897</link><guid isPermaLink="true">https://forum.qt.io/post/762897</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 28 Jun 2023 13:16:45 GMT</pubDate></item></channel></rss>