Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Screen Resolution Splash Screen

I have a splash screen image that I display with splash.showFullScreen() but it doesn't re size it to the screen resolution so it either comes out tiled or to large depending on the display. I have tried everything I can think of but nothing works. This might sound like a stupid question which it probably is but I can't find the answer so if any can just help me with this? If it makes a difference I use a QPixmap named pixmap for the splash image. By the way I want the image to be stretched to the screen resolution.

like image 907
Gerharddc Avatar asked Nov 19 '11 07:11

Gerharddc


People also ask

What size should a splash screen image be?

Splash Screen dimensions Branded image: This should be 200×80 dp. App icon with an icon background: This should be 240×240 dp, and fit within a circle of 160 dp in diameter. App icon without an icon background: This should be 288×288 dp, and fit within a circle of 192 dp in diameter.

What is splash screen?

Meaning of splash screen in Englishan image that appears on the screen of a computer, mobile phone, or other electronic device when it is first switched on, or when an app or program is starting: The splash screen shows an animated company logo that bounces around for a few seconds.


1 Answers

You should scale the pixmap to the size of the screen with QPixmap::scaled(). You can get the screen resolution by calling QDesktopWidget::screenGeometry(). The desktop widget can be obtained by QApplication::desktop().

You can try something like this:

QDesktopWidget* desktopWidget = qApp->desktop();
QRect screenGeometry = desktopWidget->screenGeometry();
int screenWidth = screenGeometry.width();
int screenHeight = screenGeometry.height();
QPixmap pixmapForSplash = yourPixmap.scaled(screenWidth, screenHeight);
QSplashScreen splashScreen(pixmapForSplash);

(I'm sorry, I can not check this, because I do not have a development environment on this computer... I hope it is correct.)

like image 128
Bill Avatar answered Sep 30 '22 00:09

Bill