QT设置widget属性为FramelessWindowHint导致界面不刷新的问题解决

据说这是QT5之后的BUG,还没有深入研究,只是找到了一个解决方法,这里做一下记录:
对窗口重载showEven,实现以下代码即可。

void BaseWindow::showEvent(QShowEvent *event)
{
#if QT_VERSION >= 0x050000
    this->setAttribute(Qt::WA_Mapped);
#endif

    QWidget::showEvent(event);
}

猜你喜欢

转载自blog.csdn.net/wizardtoh/article/details/80742831