方案一:
設置定時器:定時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