<?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[Accessing mainwindow from another class]]></title><description><![CDATA[<p dir="auto">Hello guy's,</p>
<p dir="auto">i have tried to include the mainwindow header to another class, lets call that class A, and from that class A then add a dock to the main window.</p>
<p dir="auto">The problem is, that mainwindow already uses class A and has its header file included. So i get a circular dependency.</p>
<p dir="auto">If i use forward declaration in class A and type "class MainWindow;" i can not really use any functions of the main window class in class A.</p>
<p dir="auto">Is there someone with the same problem, or does someone have a solution on how to access the mainwindow class without a circular dependency?</p>
<p dir="auto">Thanks a lot<br />
Michael</p>
]]></description><link>https://forum.qt.io/topic/134064/accessing-mainwindow-from-another-class</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 21:49:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/134064.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Feb 2022 18:47:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Accessing mainwindow from another class on Thu, 03 Feb 2022 19:13:07 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">If you want to communicate with your main window, use signals and slots.</p>
<p dir="auto">The fact that you start to have circular dependencies of that kind in a GUI application hints at an architectural issue.</p>
]]></description><link>https://forum.qt.io/post/701277</link><guid isPermaLink="true">https://forum.qt.io/post/701277</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:13:07 GMT</pubDate></item><item><title><![CDATA[Reply to Accessing mainwindow from another class on Fri, 04 Feb 2022 14:32:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> i did change a few things in the structure and now with signals and slots it works, thanks for the hint.</p>
]]></description><link>https://forum.qt.io/post/701398</link><guid isPermaLink="true">https://forum.qt.io/post/701398</guid><dc:creator><![CDATA[tiegert]]></dc:creator><pubDate>Fri, 04 Feb 2022 14:32:35 GMT</pubDate></item><item><title><![CDATA[Reply to Accessing mainwindow from another class on Thu, 03 Feb 2022 19:13:07 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">If you want to communicate with your main window, use signals and slots.</p>
<p dir="auto">The fact that you start to have circular dependencies of that kind in a GUI application hints at an architectural issue.</p>
]]></description><link>https://forum.qt.io/post/701277</link><guid isPermaLink="true">https://forum.qt.io/post/701277</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:13:07 GMT</pubDate></item><item><title><![CDATA[Reply to Accessing mainwindow from another class on Thu, 03 Feb 2022 19:06:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> how can i then access the main window class?</p>
<p dir="auto">I used something like MainWindow::addDockWidget(...) to add a dock to the main window.</p>
<p dir="auto">If i don't include the header how can i access the mainwindow class?</p>
]]></description><link>https://forum.qt.io/post/701276</link><guid isPermaLink="true">https://forum.qt.io/post/701276</guid><dc:creator><![CDATA[tiegert]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to Accessing mainwindow from another class on Thu, 03 Feb 2022 18:49:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tiegert">@<bdi>tiegert</bdi></a> said in <a href="/post/701273">Accessing mainwindow from another class</a>:</p>
<blockquote>
<p dir="auto">i have tried to include the mainwindow header to another class</p>
</blockquote>
<p dir="auto">Why?  Don't.  And then your issue will go away.</p>
]]></description><link>https://forum.qt.io/post/701274</link><guid isPermaLink="true">https://forum.qt.io/post/701274</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 03 Feb 2022 18:49:23 GMT</pubDate></item></channel></rss>