t widget設置Qt::FramelessWindowHint和Qt::WA_TranslucentBackground, 會出現一個bug: 在最小化後還原時界面中止刷新less
Widget with Qt::FramelessWindowHint and Qt::WA_TranslucentBackground stops painting after minimize/restorethis
被這個問題折騰了好幾天, 真特麼鬱悶.net
該bug在qt 5.1.1中修復, bugreport連接 https://bugreports.qt-project.org/browse/QTBUG-17548
這個bug都發現N久了, 如今才修復rest
以前的版本的話, 能夠試下下面的方法, 基本可用, 但在setwindowflag後, 任務欄圖標會滑動一下, 某些電腦可能還會略微閃爍
void TestDlg::changeEvent( QEvent* e )
{orm
if( e->type() == QEvent::WindowStateChange)
{
if(this->windowState() & Qt::WindowMinimized )
{
//do something after minimize
}
else
{
setWindowFlags(Qt::Window);//set normal window flag
setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//and return to your old flagsblog
this->showNormal();
}
}
}
Qt 真是各類坑吶get
補充: 該方法對qmainwindow無效, 在Qt5.1 qmainwindow 依然存在此問題qt
https://blog.csdn.net/haluoluo211/article/details/46930187it
我用的 QT5.7 也遇到樓主同樣的問題。如今用3樓的辦法,還真有效。特來感謝3樓!bug