Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] - Detecting OS - runtime vs build
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] - Detecting OS - runtime vs build

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 901 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
    maximus
    wrote on last edited by
    #1

    Hi guys,

    I'm currently developing a software that is available for Mac, Windows and Linux and maybe IOS later.
    I want to pop up a link when the user start my application, the link will be different if the OS is Mac/Win/Linux.

    Is it better to do this kind of coding at build time with
    @ #ifdef WIN32
    OS = "WIN";
    #else
    OS = "MAC";
    ....@

    Or at runtime with QSysInfo ?
    Thanks in advance!


    Free Indoor Cycling Software - https://maximumtrainer.com

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maximus
      wrote on last edited by
      #2

      Solved with this added in Main.cpp:

      @ QString OS;
      #ifdef Q_OS_WIN32
      OS = "WIN";
      #elif Q_OS_MAC
      OS = "MAC";
      #else
      OS = "LINUX";
      #endif
      qDebug () << "OS IS: " << OS;
      app.setProperty("OS", QVariant(OS));@


      Free Indoor Cycling Software - https://maximumtrainer.com

      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