[Development] High-dpi Qt best practices
Olivier Goffart
olivier at woboq.com
Wed Oct 10 16:56:20 CEST 2012
What is wrong with this alternative:
All the API stays always in pixel (QIcon, QWidget::geometry, ...)
QCoreApplication::setAttribute(Qt::AA_MacHighDPI)
(should it maybe be even be set by default?)
If that is set, everything is in pixel, but the default font size is twice as
big, the mac style returns pixelmetrics ans sizes that are twice as big, and
all the widgets are then automatically twice as big
In general, that's the way to do it. Having hardcoded pixel value has always
been a bad practice with Qt.
Application that did it will possibly look bad on high-res display and will
need to be fixed. But I think they will need the same amount of fixes with
the other appreach because sometimes they really mean pixel, sometimes they
mean point.
The only thing is about QPen. should we draw lines twice as large? that is
bascically what QPen::isCosmetic is for.
--
Olivier
Woboq - Qt services and support - http://woboq.com
More information about the Development
mailing list