[Development] Proposal: expose the OS/platform in QML

Mohamed Fawzi Fawzi.Mohamed at digia.com
Wed Jan 16 18:14:05 CET 2013


On 16 Jan 2013, at 17:37, Alan Alpert <416365416c at gmail.com>
 wrote:

> On Wed, Jan 16, 2013 at 2:22 AM, Rutledge Shawn
> <Shawn.Rutledge at digia.com> wrote:
>> On 16 Jan 2013, at 8:21 AM, Bache-Wiig Jens wrote:
>> 
>>> True. It is exactly what we would use to implement the platform selector. But it can also be more powerful than that because it makes it possible to implement your own platform selectors if you disagree with whatever mechanism we come up with. (i.e you can create a loader that takes dpi, os, orientation and resolution into account)
> 
> It's still not clear to me how this is intended to co-exist with the
> platform selector thread. If we implement the static selector approach
> for QML like discussed in the other thread, then you can use that in
> loaders (because you can have it apply automatically to the source URL
> passed to the Loader). So you would not need to expose the OS/platform
> to QML at all in order to implement these selectors. How would OS, DPI
> etc. be used in QML then?

Well getting information on the current system is generally available on all
platforms, and can be useful, for example as way to cope with something
not handled by selectors.
I can understand your fear of it being misused, and the problem is real,
still I think that it is more an education problem (making clear that selectors
are the superior alternative, and explain why).
If we have a good selector method I believe people will use it.

> 
>>> 
>>> I wonder how useful it is to know the platform plugin though. I.e I don't really care if I am on wayland or x11 or when writing QML. If I did, I would probably we writing a C++ extension.
>>> 
>>> What I primarily care about is if I am on "mac", "windows", "linux", "android" or "iOS". This is information I would use quite often and only exposing that would be a good start.
>> 
>> Where should we put that information?  Orientation, resolution etc. will be in Screen.  I wonder if this gives us another reason to rename the Window module to something more inclusive like System or Device.  Then it will make sense to expose all the device-specific stuff in the same module.  I want to rename it anyway to avoid having the present situation that you import QtQuick.Window in order to create a Window (and get some other stuff that comes along for the ride).
> 
> I can't find the current docs, but the mobility APIs already exposed a
> wealth of system information in the SystemInfo plugin:
> http://doc.qt.digia.com/qtmobility/qml-systeminfo.html . The right
> place for all this more device general stuff is there, we can just
> bring that back in Qt 5 (if it isn't already). I really think that
> SystemInfo is a much better place for this than Screen, which is
> supposed to encapsulate the screen you're currently running on (not
> the whole device!). It also has a lot of other useful device
> information.

I agree with idea of using SystemInfo.

> […]

Fawzi


More information about the Development mailing list