How to get the DPI of the display screen in Qt

Viewed 20336

I need to get the DPI value of display in Qt. I am able to get it in Qt 5.0 using the following:

#include <QScreen>

......
......
QScreen *srn = QApplication::screens().at(0);
qreal dotsPerInch = (qreal)srn->logicalDotsPerInch();

But the same code throws a compilation error in Qt version 4.x. My project is developed in Qt version 4.x. So I need the equivalent of the above code in Qt version 4.x.

3 Answers
Related