PDA

View Full Version : call different slots each time 'pushbutton' is clicked



rishiraj
13th February 2009, 10:46
Hi everyone,
Is it possible to call different slots each time a 'PushButton' is clicked.
Like,I have a button 'slideshow',When I click it the first time,I want the slideshow to start and when I click the 'slideshow' button the second time,the slideshow should stop.
Could someone give me some idea and hints on how to implement it ,if possible.
Thanks in advance.

jpn
13th February 2009, 12:07
Why don't you implement the logic in your slot. If the slideshow is not running, you'll start it. If the slideshow is running, you'll stop it.

rexi
14th February 2009, 22:03
What jpn suggested is probably the best, and cleanest, solution to your problem.

But, just for the sake of completeness, I want to point out the connect / disconnect pair of signal handling methods. If you want to separate the functionality into different slots, you could use this methods to do so. Just disconnect the "Start" slot from the button and connect to the "Stop" slot, and vice versa.

sgg245
16th February 2009, 07:41
In your class take a static boolean variable, initialised with FALSE.
When you click for the first time set it to TRUE i.e. SlideShow running and clicking on 2nd time set it to FALSE i.e. SlideShow stopped.

Hope this solution works for you!!!

aamer4yu
16th February 2009, 08:10
This (http://labs.trolltech.com/blogs/2008/11/08/entangling-the-signal-slot-spaghetti-with-scxml/) might also help you .