qt - Detect hiDPI mode -
working qt 4.8.4 on os x -- desktop application development. need able detect, @ paint time, if on hidpi display ("retina") or not. know how achieve this?
you can use qscreen
in qt 5, , in qt 4 can use qsystemdisplayinfo
class qt mobility.
for qt 4
there qsystemdisplayinfo
- http://doc.qt.digia.com/qtmobility/qsystemdisplayinfo.html
the relevant methods getdpiheight
, getdpiwidth
.
you use qdesktopwidget
's physicaldpix
, physicaldpiy
methods.
for qt 5
use qscreen
- http://qt-project.org/doc/qt-5.0/qtgui/qscreen.html#physicaldotsperinch-prop
((qguiapplication*)qcoreapplication::instance()) ->primaryscreen()->physicaldotsperinch()
there physicaldotsperinchx
, physicaldotsperinchy
.
Comments
Post a Comment