I'm working on a project in Qt (PySide, but any Qt solution is welcome). I need to have an image fade in and do random animation. That is done, but it creates it's own taskbar item (yuck)! Code:
self.img_Check = QPixmap("resources/checkmark.png")
self.lab = QSplashScreen(self.img_Check)
self.lab.setWindowFlags(Qt.WindowStaysOnTopHint)
self.lab.setMask(self.img_Check.mask())
If I remove the setWindowFlags(Qt.WindowStaysOnTopHint)
then it works perfectly, but it's not "Always on Top" and the user won't see the animation if he's using another application.
There's got to be a way to make an always-on-top animation without creating a menu bar item, but I'm not sure how. I do have a QMainWindow, in case you are curious.
I tried tons of flag combinations, and I can't do all 3: - Display on top of other Windows, like MS-Word. - Without taking over the active window status. - No taskbar item appear for this animation's window.
Context: Just in case you are curious why I need to do this, the program backs up a user's files in the background, and when one is finished processing, it fades in a "checkmark" icon at 50% opacity for a few seconds, so the user knows the backup is completed. I cannot use another way of indicating the backup is completed. That is the specification.
When you call
setWindowFlags
, you remove all window flags except the flags you've specified in the argument. SoQt.SplashScreen
flag is removed and the window is no longer a splash screen.You should specify
Qt.WindowStaysOnTopHint
as the second argument ofQSplashScreen
constructor. See the docs:If you would need to add
Qt.WindowStaysOnTopHint
dynamically later, you can do something likeor