Qt-interest Archive, February 2007
Signal Slot
Message 1 in thread
Hi,
Is there any way that I can pass a parameter to a slot which is not in
signal.
Something like:
For(int i=0;i<3;i++)
CONNECT(obj1,SIGNAL(clicked()),obj2,SLOT(user_defined_slot(i)));
The main issue is how to pass this "i" to t he slot called?
Thanks & Regards
Shuchi Agrawal
__________________Honeywell
Honeywell Technology Solutions Lab
Message 2 in thread
Suchi, Agrawal (IE10) wrote:
> Hi,
>
> *Is there any way that I can pass a parameter to a slot which is not in
> signal.*
>
> *Something like:*
>
> * *
>
> *For(int i=0;i<3;i++)*
>
> *
> CONNECT(obj1,SIGNAL(clicked()),obj2,SLOT(user_defined_slot(i)));*
>
> *The main issue is how to pass this âiâ to t he slot called?*
Have a look at the class QSignalMapper.
hth
M
--
[ signature omitted ]
Message 3 in thread
On Thursday 22 February 2007 12:50, Suchi, Agrawal (IE10) wrote:
> Hi,
>
> Is there any way that I can pass a parameter to a slot which is not in
> signal.
>
> Something like:
>
> For(int i=0;i<3;i++)
> CONNECT(obj1,SIGNAL(clicked()),obj2,SLOT(user_defined_slot(i)));
>
> The main issue is how to pass this "i" to t he slot called?
Take a look at QSignalMapper, http://doc.trolltech.com/4.2/qsignalmapper.html.
It can do exactly what you are wanting.
--
[ signature omitted ]
Message 4 in thread
Suchi, Agrawal (IE10) wrote:
> Hi,
>
> *Is there any way that I can pass a parameter to a slot which is not in
> signal.*
>
> *Something like:*
>
> * *
>
> *For(int i=0;i<3;i++)*
>
> *
> CONNECT(obj1,SIGNAL(clicked()),obj2,SLOT(user_defined_slot(i)));*
>
> *The main issue is how to pass this “i” to t he slot called?*
Check QSignalMapper.
Matthieu
--
[ signature omitted ]
Message 5 in thread
Ya I got the answer.
Thanks a lot for all replies :)
Thanks & Regards,
Shuchi
-----Original Message-----
From: Matthieu Brucher [mailto:matthieu.brucher@xxxxxxxxxx]
Sent: Thursday, February 22, 2007 5:32 PM
To: QT Newsletter
Subject: Re: Signal Slot
Suchi, Agrawal (IE10) wrote:
> Hi,
>
> *Is there any way that I can pass a parameter to a slot which is not
in
> signal.*
>
> *Something like:*
>
> * *
>
> *For(int i=0;i<3;i++)*
>
> *
> CONNECT(obj1,SIGNAL(clicked()),obj2,SLOT(user_defined_slot(i)));*
>
> *The main issue is how to pass this "i" to t he slot called?*
Check QSignalMapper.
Matthieu
--
[ signature omitted ]