QPushButton() should react as long as it is pressed
Asked Answered
S

1

8

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().

Sarmatia answered 5/11, 2011 at 16:5 Comment(0)
G
22

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).

Gelasias answered 5/11, 2011 at 16:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.