[Interest] How to distinguish from iPhone screen type with Qt/Qml

Jérôme Godbout godboutj at amotus.ca
Mon Dec 3 15:28:03 CET 2018


You can take a look at Qt.application.screens and detect by resolution along with Qt.platforms should be doable but I think the http://doc.qt.io/qt-5/qsysinfo.html QSysInfo will give you a better check and you can expose this to a property or Q_INVOKABLE function. It doesn't seem to have anything to display the phone model. So you can do an .mm obj-c call:
[[UIDevice currentDevice] platformString]
Should do the trick.
Put this into a QString return value function QString::fromNString() and you should be good to go. You might need to stub this on other platform.

-----Original Message-----
From: Interest <interest-bounces at lists.qt-project.org> On Behalf Of Nuno Santos
Sent: December 3, 2018 7:35 AM
To: interest at qt-project.org Interest <interest at qt-project.org>
Subject: [Interest] How to distinguish from iPhone screen type with Qt/Qml

Hi,

I’m trying to make my iOS apps ready for iPhone X screen as well as the new iPads.

How can I distinguish the screen types? Can I do that directly from Qml? How?

Thanks in advance!

Regards,

Nuno
_______________________________________________
Interest mailing list
Interest at lists.qt-project.org
https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list