PDA

View Full Version : Is there any other easy-fast way to connect a button and a on/off visualizatn method?



tonnot
9th February 2012, 12:16
I have a lot of buttons to view/hide elements.
Each time I have to write the code I have to connect signal & slots. (I must to create a slot for a simple code... )
I'd like to write a simple :

connect (widget,SIGNAL(mouse_click)), other_widget->visible= !(other_widget->visible));
I could be possible?
Any trick....
Thanks

MarekR22
9th February 2012, 12:28
If you have lots of this kind of extra slots, maybe you need a state machine? QStateMachine

wysota
9th February 2012, 14:03
Write a simple class using QSignalMapper that will do it for you.