user1978386
user1978386

Reputation: 257

How to retrieve the display resolution?

How do I retrieve the current display resolution in Qt4 or Qt5? For example, if I have my display resolution set to 1366x768, then how do I obtain this value in my application?

Upvotes: 2

Views: 192

Answers (1)

Rachel Gallen
Rachel Gallen

Reputation: 28553

One solution is to get the dimension of the QT desktop widget

#include 

qDebug () << QApplication::desktop()->screenGeometry();

It gives back a QRect, which offers functions to get the height and the width.

Upvotes: 5

Related Questions