RT,找到2个解决方法如下:
我的qt4.8.6 采用1方法解决问题,2方法无效
方法1 重写changeEvent
//头文件申明
void changeEvent(QEvent *e);
//函数实现
void myWidgetWindow::changeEvent(QEvent *e)
{
switch (e->type())
{
case QEvent::WindowStateChange:
{
this->update();
this->repaint();
e->ignore();
break;
}
default:
break;
}
}
方法2 重写showEvent
//头文件申明
void showEvent(QShowEvent *e);
//函数实现
void myWidgetWindow::showEvent(QShowEvent *e)
{
this->setAttribute(Qt::WA_Mapped);
QWidget::showEvent(e);
}