diff options
author | Miroslav Safr <miroslav.safr@tieto.com> | 2010-11-24 09:46:34 +0200 |
---|---|---|
committer | Stanislav Ionascu <stanislav.ionascu@nokia.com> | 2010-12-28 12:41:41 +0200 |
commit | 5d851dfc40535fbd35ddbf1496e26cc563b86ab1 (patch) | |
tree | bad727824be670cdc14d9a71c7481c9bac23f8df | |
parent | a39d735c6d0c8985c1cf92bc26dd0f018233e6e0 (diff) |
Fixes: BMC#10371 - Remove gconf hack in ks file to fix BMC#10058 - PPI autodetection part
RevBy: Stanislav Ionascu
Details: Old implementation of ppi autodetection uses dpi instead of ppi so it returns wrong numbers and icons are than too small
to avoid setting up target name for different devices from .ks files we can use Qt-funcitons/Xserver detection
-rw-r--r-- | src/corelib/workspace/mdeviceprofile.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/corelib/workspace/mdeviceprofile.cpp b/src/corelib/workspace/mdeviceprofile.cpp index 383ee431..110ec12b 100644 --- a/src/corelib/workspace/mdeviceprofile.cpp +++ b/src/corelib/workspace/mdeviceprofile.cpp @@ -109,13 +109,23 @@ bool MDeviceProfilePrivate::load(const QString& filename) else resolution.setHeight(settings.value("/resolution/Y", 0).toInt()); - if (settings.value("/ppi/X").toString() == "autodetect") - pixelsPerInch.setWidth(QApplication::desktop()->physicalDpiX()); + if (settings.value("/ppi/X").toString() == "autodetect") { + int widthMM = QApplication::desktop()->widthMM(); + if(widthMM){ + int autodetectedPpiX = mmPerInch * QApplication::desktop()->screenGeometry().size().width() / widthMM; + pixelsPerInch.setWidth(autodetectedPpiX); + } + } else pixelsPerInch.setWidth(settings.value("/ppi/X", 0).toInt()); - if (settings.value("/ppi/Y") == "autodetect") - pixelsPerInch.setHeight(QApplication::desktop()->physicalDpiY()); + if (settings.value("/ppi/Y") == "autodetect") { + int heightMM = QApplication::desktop()->heightMM(); + if(heightMM){ + int autodetectedPpiY = mmPerInch * QApplication::desktop()->screenGeometry().size().height() / heightMM; + pixelsPerInch.setWidth(autodetectedPpiY); + } + } else pixelsPerInch.setHeight(settings.value("/ppi/Y", 0).toInt()); |