Reputation: 855
I have a Qt application. There I want to trigger some action while QPushButton is pressed and stop it when button is released. I have read a bit and so far what I found is to reimplement mousePressEvent to start timer to emit signals and do my action and also reimplement mouseReleaseEvent to stop that timer. Is there any other way or that one is the most correct one?
Thanks and regards
Upvotes: 1
Views: 2276
Reputation: 26346
There are signals for pressed()
and released()
for QPushButton. Connect pressed()
to activate whatever you want to be activated while the button is pressed, and stop it when released()
is signaled.
Upvotes: 3