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

Zeng Huan zh.issac at gmail.com
Sun Jul 12 04:37:32 CEST 2009


Hi,
Sorry for my typo.
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

On Sun, Jul 12, 2009 at 10:35 AM, Zeng Huan <zh.issac at gmail.com> wrote:

> Hi,
>
> 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
>
> On Sun, Jul 12, 2009 at 10:17 AM, ahmmahfuz rubel <65mahfuz90 at gmail.com>wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> kde-games-devel mailing list
>> kde-games-devel at kde.org
>> https://mail.kde.org/mailman/listinfo/kde-games-devel
>>
>>
>
>
> --
> Cheers,
> Zeng Huan
>



-- 
Cheers,
Zeng Huan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-games-devel/attachments/20090712/b9da2787/attachment.htm 


More information about the kde-games-devel mailing list