简体   繁体   中英

How to get Screens DPI by Qt application in Linux framebuffer mode(without X11)

Currently I am running Qt and QML application in Embedded Linux Built using buildroot. GUI comes up good in the screen. Application runs in framebuffer mode, X11 is not present in Linux.

I want to know the DPI of the screen in my application.

I used below Qt API to get DPI

qreal screenDPI = QApplication::primaryScreen()->physicalDotsPerInch();
qDebug() << "***************screenDPI***************" << screenDPI;

Output of the above is

***************screenDPI***************inf

It is not fetching the required DPI value.

Screen size 800*480.

Same API works good in Ubuntu Linux 18.04 and Windows.

physicalDotsPerInch is not working as expected.

Is there any alternative API that I can use to get DPI of the screen in embedded Linux running in frame buffer mode .

Is it possible to get QApplication::primaryScreen()->physicalSize? If so you could calculate the DPI yourself by using the geometry of your window.

What device are you using? what is the output of : manufacturer model name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM