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. Q_OS_LINUX and Q_OS_ANDROID.
Forum Updated to NodeBB v4.3 + New Features

Q_OS_LINUX and Q_OS_ANDROID.

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 10.5k 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.
  • T Offline
    T Offline
    topocc
    wrote on last edited by
    #1

    I am testing version 5.2 and 5.3 and have noticed no difference what operating system are you using and Q_OS_ANDROID Q_OS_LINUX.

    this is the code I've tried.

    @QStringList myOpenFile;
    QString mypath = QDir::currentPath();
    #ifdef Q_OS_WIN32
    myOpenFile << mypath+"/myfiles/oth/file.txt";
    #endif
    #ifdef Q_OS_LINUX
    myOpenFile << mypath+"/myfiles/oth/file.txt";
    #endif
    #ifdef Q_OS_ANDROID
    myOpenFile << "/mnt/sdcard/myfiles/oth/file.txt";
    #endif
    @
    using qDebug obtain two outputs:

    qDebug() << myOpenFile;

    /data/data/com.example.myprogra/files/myfiles/oth/file.txt
    /mnt/sdcard/myfiles/oth/file.txt

    This error only happens on android.

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

      Android itself some kind of Linux so you'll see the output of Q_OS_LINUX and Q_OS_ANDROID under Android while you'll see single output under Windows or Linux

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbnoimi
        wrote on last edited by
        #3

        Try to use:
        [code]#if defined(Q_OS_ANDROID)
        qDebug() << "ANDROID";
        #elif defined(Q_OS_LINUX)
        qDebug() << "LINUX";
        #elif defined(Q_OS_WIN32)
        qDebug() << "WIN32";
        #endif[/code]

        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