Is Qt DPI Aware?
Are Qt4 and Qt5 DPI aware (according to the link below)? And if so, is this turned on my default or do I have to explicitly turn this on?
Writing DPI-Aware Desktop and Win32 Applications:
Thanks much for your help
It worked for me.
Better read the docs from Qt 5, there have been API changes in that area, and some new classes added. "Link":http://qt-project.org/doc/qt-5/scalability.html.
Let me ask again: Does Qt (not Qt Quick) support the DPI Aware mechanism as described in the MSDN link of my initial post?
Your answers appear to apply to Qt Quick and QML. I have a large and existing Qt application, re-writing everything to use Qt Quick is not an option.
Again, thanks for your replies.
See the "QScreen":http://qt-project.org/doc/qt-5/qscreen.html class, which actually described in the document I have linked before.
Here's how I solved this problem in my Qt app: I created a C++ class called Dims, which holds CONSTANT properties for most dimension constants such as distances, widths, heights, etc. These constants are dynamically adapted to the size of the screen and the target platform in the constructor of Dims. Then I pass Dims to QML like this:
QQmlContext *r = engine.rootContext();
Dims dims; // contains my dimension constants
r->setContextProperty ("Dims", &dims);
Now I can simply use these dimensions in QML, e.g.:
width: (Dims.msgLineLRMargin + msgText.width + Dims.msgLineLRMargin);
I created another C++ class called Fonts that serves as an abstraction for font names and sizes on different platforms. With this technique, I can use the same QML files for most cases, with an exception only where a different layout is appropriate (e.g. grid versus column).