PDA

View Full Version : Change position according to QCheckBox State



champ
6th June 2010, 18:48
Hi

I want to change the position of an object on the map if according to the state of the Qcheckbox i.e. till the Qcheckbox is in checked state the position of the object would be altered and stop when QCheckbox is unchecked ?

How can i achieve this ? Is there any inbuilt function or if a timer is needed to be used ?

I am using Qt 4.6 on Kubuntu 10.04.

Thanks

tbscope
6th June 2010, 18:51
http://doc.qt.nokia.com/4.6/qcheckbox.html#stateChanged
It's all in the documentation.

champ
6th June 2010, 18:58
Thanks. But it only works when the state changes. i want to perform the task till it is in checked state.

tbscope
6th June 2010, 19:02
Then, yes, you need a loop or timer

champ
6th June 2010, 19:18
thanks. would setting autoRepeat Property of QCheckBox to true (through Qt Designer) and passing clicked(bool) signal to the desired method is equivalent to having a timer or a loop ?

tbscope
6th June 2010, 19:37
It might be. To me this looks like a bad choice though.

I guess I would choose the timer. Use the checkbox state to start or stop the timer. Then use the timer event to update the position