以重写qpushbutton的鼠标事件为例:
- 创建一个普通的c++类
- 类中继承qpushbutton
- 重写鼠标进入,离开事件
- 将自己lable提升为自己创建的类
进一步工作:完成鼠标进入button则对button的样式进行改变
步骤:
1. 完成继承qpushbutton的类的enterevent的重写
2. 在enterevent中释放信号
3. 在button所在的cpp监听此信号
4. 大功告成
以重写qpushbutton的鼠标事件为例:
进一步工作:完成鼠标进入button则对button的样式进行改变
步骤:
1. 完成继承qpushbutton的类的enterevent的重写
2. 在enterevent中释放信号
3. 在button所在的cpp监听此信号
4. 大功告成