Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix size of splash screen
  • Loading branch information
nyalldawson committed May 15, 2023
1 parent a7e947e commit df20650
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/app/main.cpp
Expand Up @@ -1473,19 +1473,18 @@ int main( int argc, char *argv[] )
}

//set up splash screen
QString mySplashPath( QgsCustomization::instance()->splashPath() );
QPixmap myPixmap( mySplashPath + QStringLiteral( "splash.png" ) );
QString splashPath( QgsCustomization::instance()->splashPath() );
QPixmap pixmap( splashPath + QStringLiteral( "splash.png" ) );

double screenDpi = 96;
if ( QScreen *screen = QGuiApplication::primaryScreen() )
{
screenDpi = screen->physicalDotsPerInch();
pixmap.setDevicePixelRatio( screen->devicePixelRatio() );
}

int w = 600 * screenDpi / 96;
int h = 300 * screenDpi / 96;
int w = 600 * pixmap.devicePixelRatioF();
int h = 300 * pixmap.devicePixelRatioF();

QSplashScreen *mypSplash = new QSplashScreen( myPixmap.scaled( w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
QSplashScreen *mypSplash = new QSplashScreen( pixmap.scaled( w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation ) );

// Force splash screen to start on primary screen
if ( QScreen *screen = QGuiApplication::primaryScreen() )
Expand All @@ -1497,7 +1496,7 @@ int main( int argc, char *argv[] )
if ( !takeScreenShots && !myHideSplash && !settings.value( QStringLiteral( "qgis/hideSplash" ) ).toBool() )
{
//for win and linux we can just automask and png transparency areas will be used
mypSplash->setMask( myPixmap.mask() );
mypSplash->setMask( pixmap.mask() );
mypSplash->show();
}

Expand Down

0 comments on commit df20650

Please sign in to comment.