int resolution1x,resolution1y,resolution2x,resolution2y,resolution3x,resolution3y,NumberOfMonitors;
int totalx, totaly;
QRect screenres1,screenres2,screenres3;
QPoint bottomright1, bottomright2,bottomright3;
std::cout << "The Number of monitors is " << NumberOfMonitors << " \n";
if(NumberOfMonitors == 1){
bottomright1 = screenres1.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
totalx = resolution1x;
totaly = resolution1y;
}
else if (NumberOfMonitors == 2){
bottomright1 = screenres1.bottomRight();
bottomright2 = screenres2.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
resolution2x = bottomright2.x();
resolution2y = bottomright2.y();
totalx = resolution1x + resolution2x;
totaly = resolution1y + resolution2y;
}
else if (NumberOfMonitors == 2){
bottomright1 = screenres1.bottomRight();
bottomright2 = screenres2.bottomRight();
bottomright3 = screenres3.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
resolution2x = bottomright2.x();
resolution2y = bottomright2.y();
resolution3x = bottomright3.x();
resolution3y = bottomright3.y();
totalx = resolution1x + resolution2x + resolution3x;
totaly = resolution1y + resolution2y + resolution3y;
}
else{
bottomright1 = screenres1.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
totalx = resolution1x;
totaly = resolution1y;
}
std::cout << "The total x pixels are " << totalx << " \n";
std::cout << "The total y pixels are " << totaly << " \n";
std::cout << "And screen 1 has " << resolution1x << " x pixels \n";
std::cout << "And screen 1 has " << resolution1y << " y pixels \n";
int resolution1x,resolution1y,resolution2x,resolution2y,resolution3x,resolution3y,NumberOfMonitors;
int totalx, totaly;
QRect screenres1,screenres2,screenres3;
QPoint bottomright1, bottomright2,bottomright3;
NumberOfMonitors = QApplication::desktop()->screenCount();
std::cout << "The Number of monitors is " << NumberOfMonitors << " \n";
if(NumberOfMonitors == 1){
screenres1 = QApplication::desktop()->screenGeometry(1);
bottomright1 = screenres1.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
totalx = resolution1x;
totaly = resolution1y;
}
else if (NumberOfMonitors == 2){
screenres1 = QApplication::desktop()->screenGeometry(1);
screenres2 = QApplication::desktop()->screenGeometry(2);
bottomright1 = screenres1.bottomRight();
bottomright2 = screenres2.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
resolution2x = bottomright2.x();
resolution2y = bottomright2.y();
totalx = resolution1x + resolution2x;
totaly = resolution1y + resolution2y;
}
else if (NumberOfMonitors == 2){
screenres1 = QApplication::desktop()->screenGeometry(1);
screenres2 = QApplication::desktop()->screenGeometry(2);
screenres3 = QApplication::desktop()->screenGeometry(3);
bottomright1 = screenres1.bottomRight();
bottomright2 = screenres2.bottomRight();
bottomright3 = screenres3.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
resolution2x = bottomright2.x();
resolution2y = bottomright2.y();
resolution3x = bottomright3.x();
resolution3y = bottomright3.y();
totalx = resolution1x + resolution2x + resolution3x;
totaly = resolution1y + resolution2y + resolution3y;
}
else{
screenres1 = QApplication::desktop()->screenGeometry(1);
bottomright1 = screenres1.bottomRight();
resolution1x = bottomright1.x();
resolution1y = bottomright1.y();
totalx = resolution1x;
totaly = resolution1y;
}
std::cout << "The total x pixels are " << totalx << " \n";
std::cout << "The total y pixels are " << totaly << " \n";
std::cout << "And screen 1 has " << resolution1x << " x pixels \n";
std::cout << "And screen 1 has " << resolution1y << " y pixels \n";
To copy to clipboard, switch view to plain text mode
Bookmarks