Qt Hovering over a button and triggering a function?

前端 未结 1 1087
长情又很酷
长情又很酷 2021-01-26 17:06

What is the proper way of triggering a function if the mouse cursor hovers over a QButton?

To be more precise I have a label called statusLabel which should show messag

相关标签:
1条回答
  • 2021-01-26 17:20

    You have to create your own class, derived of QPushButton (or whichever class you want to capture hover events in).

    In this class, you can override QWidget::enterEvent() to detect when the mouse hovers your widget and call your function. What you can for example do is emit a custom signal that will trigger the erasing of your label.

    0 讨论(0)
提交回复
热议问题