bool FramelessWindowCentralWidget::eventFilter(QObject *watched, QEvent *e) {
// 鼠标进入或离开关闭按钮时设置为不同状态的图标
if (watched == ui->closeButton) {
if (e->type() == QEvent::Enter) {
ui->closeButton->setIcon(QIcon(":/icon/close-hover.png"));
} else if (e->type() == QEvent::Leave) {
ui->closeButton->setIcon(QIcon(":/icon/close.png"));
}
}
return QWidget::eventFilter(watched, e);
}
button->installEventFilter(this);