PDA

View Full Version : Prevent splash screen from closing itself



spraff
27th February 2011, 15:20
Hi.

I want to create a window that looks like a splash screen but does not behave like one.

It must
* have no window decorations
* appear centred on the monitor
* have no title bar presence
* and not close itself when clicked.

I've tried subclassing QSplashScreen and using a vanilla QWidget with Qt::SplashScreen window flag, either of these methods satisfies points 1 to 3. The problem is the self-closing behaviour -- it self closes even when it's not a SplashScreen but just flagged as one.

I've tried overriding hideEvent and closeEvent to e->ignore() them, but that had no effect.

What should I do instead?

Thanks a lot.

wysota
27th February 2011, 15:35
Remove the Qt::SplashScreen flag from the widget. Use Qt::FramelessWindowHint to get rid of the decorations and position the widget yourself.