Q:

Manage multiple displays

I am using QSplashScreen to display a splash screen for my QtQuick 2 application. 
 QScreen *screen = QGuiApplication::primaryScreen();
 QRect  screen_geometry = screen->geometry();
 int screen_width = screen_geometry.width();

 QPixmap pixmap("splash.png");
 QSplashScreen splash(pixmap.scaledToWidth(screen_width*0.35,Qt::SmoothTransformation));

screen_width is used to scale the image. My laptop is connected to a 2K monitor. 
The issue is, the image is shown differently for different 'Display management options', such as
'PC only' , 'Duplicate Display' & 'Second screen only'.
My question is, how to manage both displays so that the image is displayed fine on both displays.
All I need is, display the splash screen with 35% screen width. 
It should be displayed with 35% screen width in both displays.

A:

I dont know the exact solution to my problem. But this is what I am doing, for the time being.
For this I need a secondary high resolution image 
say "splash@2x.png"
Refer: https://doc.qt.io/qt-5/scalability.html#loading-files-depending-on-platform
 QScreen *screen = QGuiApplication::primaryScreen();
 QRect  screen_geometry = screen->geometry();
 int DPR = static_cast<int>(screen->devicePixelRatio()); // 1 or 2
 int screen_width = screen_geometry.width();

 QString splash_screen_image= "splash.png";

 if(DPR == 2)
 {
    //2K screen connected directly to PC
    splash_screen_image= "splash@2x.png";
    screen_width*=2;
 }

 if(DPR == 1 && screen_width >1920)
 {
    //'Second screen only' selected when laptop is connected to 2K display
    splash_screen_image= "splash@2x.png";
    screen_width*=2;
 }

 if(DPR == 1 && screen_width <=1920)
 {
    //'Duplicate display' or 'PC only' selected when laptop is connected to 2K display
    // or Desktop PC connected to HD monitor
    //Use "splash.png"
 }

 QPixmap pixmap(splash_screen_image);
 QSplashScreen splash(pixmap.scaledToWidth(screen_width*0.35,Qt::SmoothTransformation));

