Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Multiplatform app: check for platform in QML
Forum Updated to NodeBB v4.3 + New Features

Multiplatform app: check for platform in QML

Scheduled Pinned Locked Moved Solved Mobile and Embedded
iosandroid
3 Posts 2 Posters 2.3k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iNour
    wrote on last edited by
    #1

    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

    ekkescornerE 1 Reply Last reply
    0
    • I iNour

      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

      ekkescornerE Offline
      ekkescornerE Offline
      ekkescorner
      Qt Champions 2016
      wrote on last edited by
      #2

      @iNour this is easy. per ex

      Qt.platform.os == "ios"
      

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.9 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      1 Reply Last reply
      3
      • I Offline
        I Offline
        iNour
        wrote on last edited by
        #3

        Thank you very much.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved