方案一:
设置定时器:定时update、repaint或者adjustSize。
参考:https://blog.csdn.net/xiezhongyuan07/article/details/79924902
方案二(推荐):
重写showEvent函数
void showEvent(QShowEvent *e)
{
this->setAttribute(Qt::WA_Mapped);
QWidget::showEvent(e);
}
参考:https://blog.csdn.net/jiedesheng/article/details/79481496