well i don't think the "large" and "xlarge" definitions are available in
Qt, so you might need to redefine them yourself. but that shouldn't be
too hard. you could say "<6 inch: phone", ">6 inch: tablet" or something.
other than that, the code in your link seems to do just what i said:
check the screen size. or am i wrong about that?
to do so in Qt, what we do is the following:
QRect screenGeometry = QApplication::desktop()->availableGeometry();
int dpiY = app->desktop()->physicalDpiY();
int dpiX = app->desktop()->physicalDpiX();
double displayWidthInch = screenGeometry.width() / dpiX;
double displayHeightInch = screenGeometry.height() / dpiY;
double displayDiagonalInch = sqrt(displayWidthInch*displayWidthInch +
displayHeightInch*displayHeightInch); // screen diagonal size in inches
now you have everything you need to determine the size (and also
orientation) of the screen.
to dynamically handle orientation changes, you can use the
QApplication::desktop().workAreaResized(int) signal.
hope that's what you asked for. sorry if not.
king regards