[Android-development] Physical Screen Sizes in Qt-5.3.1

Harri Pasanen harri at mpaja.com
Mon Jun 30 21:45:21 CEST 2014


As a side note, I noticed that while Nexus 7 2013 did report its screen 
size accurately, Archos Titanium 40 suffers from illusions of grandeur 
and reports way too big sizes.

That makes it kind of useless API, as it seems you cannot trust it...

Harri

On 30/06/2014 11:23, Robert Iakobashvili wrote:
>
>
>
> On Mon, Jun 30, 2014 at 8:00 AM, Robert Iakobashvili 
> <coroberti at gmail.com <mailto:coroberti at gmail.com>> wrote:
>
>     Gentlemen,
>
>     To detect the physical size of a device,
>     the following code was effective with Qt-5.2.1
>     and run from main() before calling to:
>
>      mainWindow.show();
>      int rval = appl.exec();
>
>     // Screen size detection code:
>
>     QScreen* firstScreen = QGuiApplication::primaryScreen();
>
>     if (firstScreen)
>     {
>             qreal widthMM = firstScreen->physicalSize().width();
>             qreal heightMM = firstScreen->physicalSize().height();
>             qreal diagonalMM = sqrt(widthMM*widthMM + heightMM*heightMM);
>             this->screen_inches_size_ = diagonalMM/25.0;
>             qDebug() << "Screen (first) Inches Size is: " <<
>     this->screen_inches_size_;
>     }
>
>     Now, the sizes are just zeroes if called prior to mainWindow.show();
>      int rval = appl.exec();
>
>     Where's the right place to call it Qt-5.3.1, and what are the best
>     practices
>     to detect the physical sizes of an Android device at the latest Qt?
>
>     Thank you in advance.
>
>     Regards,
>     Robert
>
>
> To add that the physical size detection code works
> properly with Qt-5.3.0.
>
> It appears that it was broken by Qt-5.3.1
>
> Thanks,
> Robert
>
>
>
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20140630/3a99b43e/attachment.html>


More information about the Android-development mailing list