Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QPushButton() should react as long as it is pressed

I am using QPushButton() in my programme. With these buttons I rotate my object. Works fine so far. The only Problem is that i have to click multiple times to rotate the object a little further. This is a bit annoying. Isnt there a possibility that the button will stay pressed as long as I press it and the object will rotate further. There is the function pressed(), but there is no difference to clicked().

like image 638
buddy Avatar asked Nov 05 '11 16:11

buddy


1 Answers

QAbstractButton has an auto-repeat feature that you can turn on:

button->setAutoRepeat(true);

This will emit the pressed(), released(), and clicked() signals repeatedly. You can also specify how often the signals are emitted (setAutoRepeatInterval), and how long the button waits before it starts emitting them (setAutoRepeatDelay).

like image 69
Daniel Gallagher Avatar answered Sep 17 '22 11:09

Daniel Gallagher