参考:https://blog.csdn.net/weixin_42781353/article/details/82261339
1. 如果是普通的QWidget,需要在构造函数添加如下内容:
setMouseTracking(true);
2. 如果是 MainWindow ,则需要在构造函数添加如下内容:
setMouseTracking(true);
ui->centralWidget->setMouseTracking(true);
参考:https://blog.csdn.net/weixin_42781353/article/details/82261339
1. 如果是普通的QWidget,需要在构造函数添加如下内容:
setMouseTracking(true);
2. 如果是 MainWindow ,则需要在构造函数添加如下内容:
setMouseTracking(true);
ui->centralWidget->setMouseTracking(true);