[Solved]Get the size of the screen
-
Greetings.
I wanted to know as I can, from my program code, get the size or resolution of the screen. I need that information to adapt the size of some widgets based on the size of the screen, so that is always displayed correctly, regardless of the application running on machines with different screen sizes.
I guess there must be some sort and / or function to obtain this information, but have not given to her.
Thanks in advance for any help and / or suggestions.
-
You can obtain the screen size using "an instance of class QDesktopWidget":http://qt-project.org/doc/qt-5.0/qtwidgets/qdesktopwidget.html obtained through method "desktop of class QApplication":http://qt-project.org/doc/qt-5.0/qtwidgets/qapplication.html#desktop. For example:
@
QRect rect = QApplication::desktop()->rect();
@ -
QDesktopWidget::screenGeometry
-
Hi,
Using QLayout makes sure that your widgets are displayed correctly everywhere.