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

Nurmi J-P jpnurmi at digia.com
Tue Jan 15 17:27:36 CET 2013


Hi all,

What do you think about exposing the underlying operating system and/or platform name in QML?

Whilst separating platform specific things to separate files (alike "platform content selection") is probably a good solution in general, it sounds a bit overkill for a project like the desktop components that often need to tweak things based on the underlying platform.

My proposal is to provide the name of the operating system (more or less matching the Q_OS_XXX macros) and possibly the name of the platform (matching QGuiApplication::platformName). Here are a few ideas where these read-only properties could be placed:

a) re-use the existing Qt.application object
- Qt.application.os // Q_OS_XXX equivalent
- Qt.application.platform // QGuiApplication::platformName

b) introduce Qt.platform
- Qt.platform.os // Q_OS_XXX equivalent
- Qt.platform.name // QGuiApplication::platformName

c) introduce Qt.os
- Qt.os.name // Q_OS_XXX equivalent
- Qt.os.platform // QGuiApplication::platformName

Which one of these proposals do you like the most, or are you against the whole idea?

--
J-P Nurmi





More information about the Development mailing list