[Interest] QSplashScreen and multiple screens.

Alex Malyushytskyy alexmalvtk at gmail.com
Fri Mar 2 03:04:32 CET 2012


I've just got weird looking case when my software is running on the
systems with multiple screens.

My main application window saves its last position and size, so if it
was moved to second monitor it will be re-opened there.
But QSplashScreen will still be shown on the primary screen at startup.

I tried to look in documentation, but found it more confusing than helpful:

"QSplashScreen::QSplashScreen ( QWidget * parent, const QPixmap &
pixmap = QPixmap(), Qt::WindowFlags f = 0 )
,,,  The typical use for this constructor is if you have a multiple
screens and prefer to have the splash screen on a different screen
than your primary one. In that case pass the proper desktop() as the
parent."

Above line means that it is possible to have multiple desktops, but if
it is talking about QApplication::desktop() (AFAIK) it is supposed to
be only one.

So I assume that this is a bug in the documentation and it is
QApplication::desktop() ->screen( screenNumber ) which is supposed to
be passed
and as far as I understand the whole sequence should look like:

1. Create main window and restore it geometry,
2. determine screen number it will be shown on , but before it is
shown with QDesktopWidget ::screenNumber( const QWidget* widget )
const
3. Create and show splash screen as a child of determined screen number.


Now  I already made QSplashScreen a child of my main application
window and I expected this to be done automatically to be done
automatically when QSplashScreen is shown.
Is there any problem with my logic?
In other words why QSplashScreen (if have parent)  does not check that
this parent is not a screen and find correct screen for its parent?

Regards,
Alex



More information about the Interest mailing list