When you call setWindowFlags
, you remove all window flags except the flags you've specified in the argument. So Qt.SplashScreen
flag is removed and the window is no longer a splash screen.
You should specify Qt.WindowStaysOnTopHint
as the second argument of QSplashScreen
constructor. See the docs:
QSplashScreen::QSplashScreen(const QPixmap & pixmap = QPixmap(), Qt::WindowFlags f = 0)
There should be no need to set the widget flags, f, except perhaps Qt::WindowStaysOnTopHint.
If you would need to add Qt.WindowStaysOnTopHint
dynamically later, you can do something like
self.lab.setWindowFlags(self.lab.windowFlags() | Qt.WindowStaysOnTopHint)
or
self.lab.setWindowFlags(Qt.SplashScreen | Qt.WindowStaysOnTopHint)