call different slots each time 'pushbutton' is clicked
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.
Re: call different slots each time 'pushbutton' is clicked
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.
Re: call different slots each time 'pushbutton' is clicked
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.
Re: call different slots each time 'pushbutton' is clicked
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!!!
Re: call different slots each time 'pushbutton' is clicked
This might also help you .