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. Does QT have any way of "knowing" which plataform is being used?

Does QT have any way of "knowing" which plataform is being used?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 230 Views 1 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.
  • M Offline
    M Offline
    Mr.Desmoo
    wrote on last edited by
    #1

    Hi, I'm doing a project that works on both desktop and mobile, the problem is... How can I tell QT that the project is running on desktop or mobile? The screen design is different between desktop and mobile, and, as we know, the size / resolution between a pc and a mobile phone can be very different, making automatic resizing very difficult. So is there any way for QT to know when it's mobile or desktop?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Since the exe of a Desktop will be different than the exe for a phone then normally one uses
      #ifdef Q_OS_ANDROID
      ...code..
      #endif

      Q_OS_LINUX
      Q_OS_WIN64
      Q_OS_IOS

      etc to have platform dependant code so it's only compiled in when app is compiled for that platform.

      full list here
      https://doc.qt.io/qt-5/qtglobal.html

      1 Reply Last reply
      1

      • Login

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