Qt includes a very simple method to get the size of the screen (width and height). Here it is:
QSize size = qApp->screens()[0]->size();
Note that this function works perfectly in Android and iOS too.
Another thing to note is that if you replace [0] with 1, 2, 3, … you can access other monitors (if there are any) on desktop computers.
Thanks a lot 😉