Important: Please read the Qt Code of Conduct -

Multiplatform app: check for platform in QML

  • Hello,
    I'm building an app for iOS and Android.
    One of the functionalities is to allow the user to choose a photo from the phone.
    For iOS, I used FileDialog.
    For android, I used ListView with FolderListModel to show the pictures from the mobile.

    I wrote both of these in the same QML.

    My question here is: how can I check if the platform is android or iOS to know which one to activate.

    Or if this is not possible, what's the recommendation on how to make this work?

    Thanks in advance

  • Qt Champions 2016

    @iNour this is easy. per ex

    Qt.platform.os == "ios"

  • Thank you very much.

Log in to reply