首先要响应鼠标事件,然后通过 Style Sheets 改变按钮的外观1. 从QPushButton派生一个自己的按钮类2.在新类的构造函数中 调用 mouseTracking(true)以获取鼠标移动事件。

3、 重载 mouseMoveEvent(),在该函数中通过StyleSheet改变外观 如: setStyleSheet("background: yellow”) Qt Style Sheets的使用请参考 Assistance中的内容 和 Style Sheet Example