Unsolved QPushbutton
-
Hi friends,
I want to display color flashing for QPushbutton can anybody give example code to solve this problem.
-
@satyanarayana143 said in QPushbutton:
color flashing
Do you mean an animation? Check this: https://doc.qt.io/qt-5/animation.html
-
while playing audio by clicking Qpushbutton untill playing it should blink .
-
@satyanarayana143 Check the link I provided...
-
@jsulm
I didn't know about this class. I have widgets (FWIW,QSpinBox
es) which I want to flash for a few seconds, when their value changes, and then stop. Sometimes many of them flash simultaneously. I implemented this via my ownQTimer
(just one instance of that) code.Am I missing out on anything? I like to keep the application "lightweight", so don't have any need to call QAnimation stuff.
-
some example code
-
for Qpushbutton i had set color green it should blink untill i stop for button any example code
-
@satyanarayana143
Why do you want example code? It would be quite a bit. I maintain a list of all widgets I wish to flash, to which I add & remove. I have a singleQTimer
. On elapsation I go through the list toggling the flash state, or removing items if they have flashed enough times. Flashing color is achieved by toggling the alpha state onwidget->setPalette()
.Oh, maybe you mean you example code of mine to give to you? Wait until @jsulm answers me. But if you are writing from scratch, unlike me, you should probably follow the link he gave you and do yours via animation instead.
-
@JonB Nothing wrong with your approach. But I think these animation classes can be quite handy.
-
I answered this previously, with an examlple for QFrame as base class here:
https://forum.qt.io/topic/96728/change-button-color/3You should be able to adjust it for QPushButton.