[Interest] DPI

Constantin Makshin cmakshin at gmail.com
Sun Feb 23 14:23:35 CET 2014


I'd say there's no 100% reliable cross-platform solution and Qt can't do
anything about it — the screen itself may return incorrect information
about its physical size, OS may somehow misinterpret that information or
simply fake it by reversing the calculations (i.e. calculate physical
size by multiplying resolution and some predefined DPI value), etc..

On 02/23/2014 05:03 PM, igor.mironchik at gmail.com wrote:
> I’m absolutely sure that Qt determines DPI wrong.
>  
> I’ve received from Qt that my screen has 72 DpiY, where actually it has 130.
>  
> So my question is what can I use else then QDesktopIWidget::physicalDpiY()?
>  
> I need cross-platform solution of finding average finger size (it’s
> somewhere 10 mm)...
>  
> *From:* Andre Somers <mailto:andre at familiesomers.nl>
> *Sent:* Sunday, February 23, 2014 1:30 PM
> *To:* interest at qt-project.org <mailto:interest at qt-project.org>
> *Subject:* Re: [Interest] DPI
>  
> igor.mironchik at gmail.com schreef op 23-2-2014 13:24:
>> Hi.
>>  
>> I want to determine how much pixels in 10 mm.
>>  
>> I use the next calculations:
>>  
>> staticconstqrealfingerSize=0.0393700787*10;
>>  
>> staticconstqrealh=
>> (qreal)QApplication::desktop()->physicalDpiY()*fingerSize;
>>  
>> And this calculations return to me 28 that on my desktop is 5 mm only.
>>  
>> 0.0393700787 is how  much inches in millimeter...
>>  
>> What am I doing wrong?
> Are you sure that the right physicalDpi is returned? That is not a value
> you can absolutely rely on.
> 
> André

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140223/1c87c70c/attachment.sig>


More information about the Interest mailing list