changing the text of push button on hover
-
wrote on 22 Jun 2023, 13:38 last edited by
Hi
As far as i know, to change UI of pushbutton on hover, we have to change the style sheet. But using that, i cant change the text of the button on hover. Is there any way to do that?
-
Hi
As far as i know, to change UI of pushbutton on hover, we have to change the style sheet. But using that, i cant change the text of the button on hover. Is there any way to do that?
-
@Prabhav
No, you cannot change text via stylesheet. If you want to do that you will need to deal with the hover event in code. -
wrote on 23 Jun 2023, 10:06 last edited by JonB
@Prabhav
Simply by GooglingQPushButton hover event
. One of my answers on this forum is at https://forum.qt.io/topic/123237/pyside6-funtion-on-enterevent-or-hovering-on-child-widget/3. Either subclass and do your work inenterEvent()
or useeventFilter()
if you don't want to subclass. Set the button's text there to whatever desired. And unset onleaveEvent()
.
1/4