Solved How to get Screen scale?
-
![alt text]( image url)
As shown above,How can I get this data from QML?
import QtQuick.Window 2.0
Screen method is available? -
@zhangXianxiang
A bit late, but you can try this:QApplication app(argc, argv); qDebug() << (app.desktop()->logicalDpiX()/96.0)*100.0;
You can pass the value to the QML context, if you wish.
-
nice , thank you very much🤓
-
@zhangXianxiang
I don't know however how to get the default DPI value (96 on my Windows PC).From
https://en.wikipedia.org/wiki/Dots_per_inch
this default value seems to be 72 for Mac:Since the 1980s, the Microsoft Windows operating system has set the default display "DPI" to 96 PPI, while Apple/Macintosh computers have used a default of 72 PPI.
In any case, if your problem is answered, could you mark this question as solved?
Cheers. -
i'm sorry, I seem have forgotten