[Kde-games-devel] Problem with signals and slots

ahmmahfuz rubel 65mahfuz90 at gmail.com
Sun Jul 12 04:17:13 CEST 2009


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!).

This is what I have done to connect two different classes:

I have a signal declared in MainWindow(inheritx kxmlGuiWindow) class named
signalLoadTheme()
and a slot in ThemeManager class(inherits QSvgRenderer) named
slotLoadTheme().

I created a instance of ThemeManager in MainWindow name m_gameTheme(
ThemeManager* m_Theme)
and connected them in MainWindow using:

 *connect(this, SIGNAL( signalLoadTheme()), m_gameTheme, SLOT(
slotLoadTheme() ));*


I used Q_OBJECT in both of the classes at first (tried also including moc
files).


But, this is not working, my program is crashing.

*mahfuz at mahfuz-desktop:/usr/local/bin$ ./TestSignalSlot
KCrash: Application 'TestSignalSlot' crashing...
sock_file=/home/mahfuz/.kde/socket-mahfuz-desktop/kdeinit4__0
Warning: connect() failed: : No such file or directory
KCrash cannot reach kdeinit, launching directly.

*
The necessary parts of my program is attached here(Not full, it is big).

Please Help. Also, let me know, when and why including the moc file is must.

Thanks in advance.
Mahfuz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-games-devel/attachments/20090712/3eb2178d/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestSignalSlot.tar.gz
Type: application/x-gzip
Size: 2767 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20090712/3eb2178d/attachment.gz 


More information about the kde-games-devel mailing list