Actually, there was a 2 way problem. I tried both and both failed.<br><br>Because if setupWidgets() is called first then m_gameTheme is invalid and if setupGame() is first then
<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }</style> emit signalLoadTheme(); is invalid as connection is not made yet. So, though not crash in this case, the slot will not be called.<br><br>Thanks for help<br>Mahfuz<br><br><div class="gmail_quote">
On Sun, Jul 12, 2009 at 9:37 AM, Zeng Huan <span dir="ltr"><<a href="mailto:zh.issac@gmail.com">zh.issac@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>Sorry for my typo.<br>you did not create your m_gameTheme before you make
connection to it, just put setupGame() before setupWidgets()* can fix your
problem. line23:24 in MainWindow.cpp<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Sun, Jul 12, 2009 at 10:35 AM, Zeng Huan <span dir="ltr"><<a href="mailto:zh.issac@gmail.com" target="_blank">zh.issac@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>you did not create your m_gameTheme before you make connection to it, just put setupGame() before m_gameTheme can fix your problem. line23:24 in MainWindow.cpp<br><br><div class="gmail_quote"><div><div></div><div>
On Sun, Jul 12, 2009 at 10:17 AM, ahmmahfuz rubel <span dir="ltr"><<a href="mailto:65mahfuz90@gmail.com" target="_blank">65mahfuz90@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>I am having some problem when I tried to connect signals and slots of different classes. It was not a problem when I connected signals and slots within the same class(I even don't included the moc file!).<br>
<br>This is what I have done to connect two different classes:<br>
<br>I have a signal declared in MainWindow(inheritx kxmlGuiWindow) class named signalLoadTheme() <br>and a slot in ThemeManager class(inherits QSvgRenderer) named slotLoadTheme(). <br><br>I created a instance of ThemeManager in MainWindow name m_gameTheme( ThemeManager* m_Theme)<br>
and connected them in MainWindow using:<br><br>
<p style="margin: 0px; text-indent: 0px;"><b>connect(this, SIGNAL( signalLoadTheme()), m_gameTheme, SLOT( slotLoadTheme() ));</b></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">
I used Q_OBJECT in both of the classes at first (tried also including moc files).</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">But, this is not working, my program is crashing.<br>
</p><br><b>mahfuz@mahfuz-desktop:/usr/local/bin$ ./TestSignalSlot <br>KCrash: Application 'TestSignalSlot' crashing...<br>sock_file=/home/mahfuz/.kde/socket-mahfuz-desktop/kdeinit4__0<br>Warning: connect() failed: : No such file or directory<br>
KCrash cannot reach kdeinit, launching directly.<br><br></b><br>The necessary parts of my program is attached here(Not full, it is big).<br><br>Please Help. Also, let me know, when and why including the moc file is must.<br>
<br>Thanks in advance.<br>Mahfuz<br><br>
<br></div></div>_______________________________________________<br>
kde-games-devel mailing list<br>
<a href="mailto:kde-games-devel@kde.org" target="_blank">kde-games-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-games-devel" target="_blank">https://mail.kde.org/mailman/listinfo/kde-games-devel</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Cheers,<br><font color="#888888">Zeng Huan<br>
</font></blockquote></div><br><br clear="all"><br></div></div>-- <br>Cheers,<br><font color="#888888">Zeng Huan<br>
</font><br>_______________________________________________<br>
kde-games-devel mailing list<br>
<a href="mailto:kde-games-devel@kde.org">kde-games-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-games-devel" target="_blank">https://mail.kde.org/mailman/listinfo/kde-games-devel</a><br>
<br></blockquote></div><br>