[KDE-India] signals and slots

sharan rao sharanrao at gmail.com
Wed Aug 2 21:52:13 CEST 2006


On 8/2/06, G Karunakar <indlinux at gmail.com> wrote:
> 
>         QObject::connect(greet, SIGNAL(clicked()),
>                         text2, SLOT(setText(QString)));
>         QObject::connect(text, SIGNAL(valueChanged()),
>                         text2, SLOT(setText(QString)));
> 
> 
> 
> on clicking greet, display the entered text of "text" in  "text2",
> whats the correct way?
> i guess may figure that out few lessons down, but nyways asking :)
> 
> 

you should create a new slot say slotSwitchText() which will contain code
for setting the text of text2 to text of text1.

and then do a 
   connect( greet , SIGNAL( clicked() ),
            this , SLOT ( slotSwitchText() ) );

reading this may help http://doc.trolltech.com/4.1/signalsandslots.html

 sharan



More information about the KDE-india mailing list