Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-12 Thread Gilles Valette
Message de Soumen banerjee :

> hi,
> thaks for all the help, ill check it out. actually im kinda new to Qt
> and C++ having extensively used PyQt before. and why is it the wrong
> forum to post this in? where do i post it then?

Hi,

This list is for questions related to QtCreator. For questions  
regarding Qt, the following list is more suitable:
Qt-interest mailing list
qt-inter...@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

Regards,

Gilles

___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-12 Thread Soumen banerjee
hi,
thaks for all the help, ill check it out. actually im kinda new to Qt
and C++ having extensively used PyQt before. and why is it the wrong
forum to post this in? where do i post it then?
regards,
soumen
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-07 Thread Eike Ziller

On Dec 6, 2009, at 12:48 PM, ext Soumen banerjee wrote:

> In the files attached, mainwindow.cpp has the following line
> 
> connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
> 
> where ptr is of type mythread* which is derived from QThread
> the application compiles without error but on running, quits with
> segfault. Omitting the connect line solves the problem but removes all
> the functionality. How do you connect these together?
> Regards
> Soumen

You don't give "ptr" a value before calling "connect". Moving "ptr=new 
mythread(this);" before the "connect" statement (or something similar) should 
do it for you.

-- 
Eike Ziller
Software Engineer
Nokia, Qt Development Frameworks
Phone  +49 (0)30 6392 3255
Fax+49 (0)30 6392 3256
E-mail eike.zil...@nokia.com






___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-06 Thread Alan Westbrook
This is also the wrong forum to be posting this in.

On Sun, Dec 6, 2009 at 10:41 AM, Danny Price wrote:

> Even so, the pointer should have been initialised to 0 or NULL in the
> initializer list. Leaving pointers to contain junk is never a good idea.
>
> On 6 Dec 2009, at 17:59, Gilles Valette wrote:
>
> > Message de Danny Price :
> >
> >> Always use initializer lists.
> >>
> >
> > He can't because this call is not made in a constructor but in a slot
> > corresponding to a button click, and a new thread is created at each
> > click. I am not saying that it is the best way to do it (I actually do
> > not know the goal of the code...), I was just answering to the
> > question about the segfault in the given code.
> >
> > Regards,
> >
> > Gilles
> >
> >> On 6 Dec 2009, at 13:39, Gilles Valette wrote:
> >>
> >>> Message de Soumen banerjee :
> >>>
>  In the files attached, mainwindow.cpp has the following line
> 
>  connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
> 
>  where ptr is of type mythread* which is derived from QThread
>  the application compiles without error but on running, quits with
>  segfault. Omitting the connect line solves the problem but removes all
>  the functionality. How do you connect these together?
>  Regards
>  Soumen
> 
> >>>
> >>> Hi,
> >>>
> >>> In mainwindow.cpp when you call connect, ptr is undefined, causing the
> >>> segfault.
> >>>
> >>> Putting the two lines in this order solves the problem :
> >>>
> >>>ptr=new mythread(this);
> >>>connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
> >>>
> >>> Hope this helps.
> >>>
> >>> Gilles
> >>>
> >>>
> >>> ___
> >>> Qt-creator mailing list
> >>> Qt-creator@trolltech.com
> >>> http://lists.trolltech.com/mailman/listinfo/qt-creator
> >>
> >> ___
> >> Qt-creator mailing list
> >> Qt-creator@trolltech.com
> >> http://lists.trolltech.com/mailman/listinfo/qt-creator
> >>
> >>
> >
> >
> >
> > --
> > Gilles VALETTE - PhD
> > Maître de conférences en informatique - IUT de Reims
> > Université de Reims Champagne-Ardenne (URCA) - CReSTIC EA3804
> > Rue des Crayères, BP 1035 51687 Reims Cedex 2 (France)
> > Tel: +33 (0)3 26 91 84 58
> > http://www.crestic.univ-reims.fr/fiche.php?id=216
> >
> >
> >
> > ___
> > Qt-creator mailing list
> > Qt-creator@trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-creator
>
>
> ___
> Qt-creator mailing list
> Qt-creator@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-06 Thread Danny Price
Even so, the pointer should have been initialised to 0 or NULL in the 
initializer list. Leaving pointers to contain junk is never a good idea.

On 6 Dec 2009, at 17:59, Gilles Valette wrote:

> Message de Danny Price :
> 
>> Always use initializer lists.
>> 
> 
> He can't because this call is not made in a constructor but in a slot  
> corresponding to a button click, and a new thread is created at each  
> click. I am not saying that it is the best way to do it (I actually do  
> not know the goal of the code...), I was just answering to the  
> question about the segfault in the given code.
> 
> Regards,
> 
> Gilles
> 
>> On 6 Dec 2009, at 13:39, Gilles Valette wrote:
>> 
>>> Message de Soumen banerjee :
>>> 
 In the files attached, mainwindow.cpp has the following line
 
 connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
 
 where ptr is of type mythread* which is derived from QThread
 the application compiles without error but on running, quits with
 segfault. Omitting the connect line solves the problem but removes all
 the functionality. How do you connect these together?
 Regards
 Soumen
 
>>> 
>>> Hi,
>>> 
>>> In mainwindow.cpp when you call connect, ptr is undefined, causing the
>>> segfault.
>>> 
>>> Putting the two lines in this order solves the problem :
>>> 
>>>ptr=new mythread(this);
>>>connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
>>> 
>>> Hope this helps.
>>> 
>>> Gilles
>>> 
>>> 
>>> ___
>>> Qt-creator mailing list
>>> Qt-creator@trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-creator
>> 
>> ___
>> Qt-creator mailing list
>> Qt-creator@trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-creator
>> 
>> 
> 
> 
> 
> -- 
> Gilles VALETTE - PhD
> Maître de conférences en informatique - IUT de Reims
> Université de Reims Champagne-Ardenne (URCA) - CReSTIC EA3804
> Rue des Crayères, BP 1035 51687 Reims Cedex 2 (France)
> Tel: +33 (0)3 26 91 84 58
> http://www.crestic.univ-reims.fr/fiche.php?id=216
> 
> 
> 
> ___
> Qt-creator mailing list
> Qt-creator@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator


___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-06 Thread Gilles Valette
Message de Danny Price :

> Always use initializer lists.
>

He can't because this call is not made in a constructor but in a slot  
corresponding to a button click, and a new thread is created at each  
click. I am not saying that it is the best way to do it (I actually do  
not know the goal of the code...), I was just answering to the  
question about the segfault in the given code.

Regards,

Gilles

> On 6 Dec 2009, at 13:39, Gilles Valette wrote:
>
>> Message de Soumen banerjee :
>>
>>> In the files attached, mainwindow.cpp has the following line
>>>
>>> connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
>>>
>>> where ptr is of type mythread* which is derived from QThread
>>> the application compiles without error but on running, quits with
>>> segfault. Omitting the connect line solves the problem but removes all
>>> the functionality. How do you connect these together?
>>> Regards
>>> Soumen
>>>
>>
>> Hi,
>>
>> In mainwindow.cpp when you call connect, ptr is undefined, causing the
>> segfault.
>>
>> Putting the two lines in this order solves the problem :
>>
>> ptr=new mythread(this);
>> connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
>>
>> Hope this helps.
>>
>> Gilles
>>
>>
>> ___
>> Qt-creator mailing list
>> Qt-creator@trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
> ___
> Qt-creator mailing list
> Qt-creator@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
>



-- 
Gilles VALETTE - PhD
Maître de conférences en informatique - IUT de Reims
Université de Reims Champagne-Ardenne (URCA) - CReSTIC EA3804
Rue des Crayères, BP 1035 51687 Reims Cedex 2 (France)
Tel: +33 (0)3 26 91 84 58
http://www.crestic.univ-reims.fr/fiche.php?id=216



___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-06 Thread Danny Price
Always use initializer lists.

On 6 Dec 2009, at 13:39, Gilles Valette wrote:

> Message de Soumen banerjee :
> 
>> In the files attached, mainwindow.cpp has the following line
>> 
>> connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
>> 
>> where ptr is of type mythread* which is derived from QThread
>> the application compiles without error but on running, quits with
>> segfault. Omitting the connect line solves the problem but removes all
>> the functionality. How do you connect these together?
>> Regards
>> Soumen
>> 
> 
> Hi,
> 
> In mainwindow.cpp when you call connect, ptr is undefined, causing the  
> segfault.
> 
> Putting the two lines in this order solves the problem :
> 
> ptr=new mythread(this);
> connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
> 
> Hope this helps.
> 
> Gilles
> 
> 
> ___
> Qt-creator mailing list
> Qt-creator@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator

___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-06 Thread Gilles Valette
Message de Soumen banerjee :

> In the files attached, mainwindow.cpp has the following line
>
> connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));
>
> where ptr is of type mythread* which is derived from QThread
> the application compiles without error but on running, quits with
> segfault. Omitting the connect line solves the problem but removes all
> the functionality. How do you connect these together?
> Regards
> Soumen
>

Hi,

In mainwindow.cpp when you call connect, ptr is undefined, causing the  
segfault.

Putting the two lines in this order solves the problem :

 ptr=new mythread(this);
 connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));

Hope this helps.

Gilles


___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


[Qt-creator] Connecting signals from child thread with slots in main thread

2009-12-06 Thread Soumen banerjee
In the files attached, mainwindow.cpp has the following line

connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int)));

where ptr is of type mythread* which is derived from QThread
the application compiles without error but on running, quits with
segfault. Omitting the connect line solves the problem but removes all
the functionality. How do you connect these together?
Regards
Soumen


mainwindow.cpp
Description: Binary data


mainwindow.h
Description: Binary data


mainwindow.ui
Description: Binary data


thread.cpp
Description: Binary data


thread.h
Description: Binary data


Thread.pro
Description: Binary data


ui_mainwindow.h
Description: Binary data
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator