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. Discover full screen resolution of Android Device in Immersive mode
Forum Updated to NodeBB v4.3 + New Features

Discover full screen resolution of Android Device in Immersive mode

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

    Hello,

    This is my first post on the Qt forums so please be gentle :).

    My android app is running in Immersive mode https://developer.android.com/training/system-ui/immersive.html

    I am implementing it in Qt using

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    QQuickWindow *window = qobject_cast<QQuickWindow *>(engine.rootObjects().first());
        window->showFullScreen();
    

    I would like to discover the full screen resolution of the device for ui scaling so I use the following

    QRect rect = qApp->primaryScreen()->geometry();
        qreal height = qMax(rect.width(), rect.height());
        qreal width = qMin(rect.width(), rect.height());
    

    My problem is that the above returns the total screen resolution of the device minus the navigation bar. For example my Nexus 10 is 2560x1600 but my code returns 2560x1504( or 2464x1600 if in portrait mode).

    Is there any way for find out the actual full screen resolution of an android device?

    Adam

    1 Reply Last reply
    0
    • fecubF Offline
      fecubF Offline
      fecub
      wrote on last edited by fecub
      #2

      Hi Adam and welcome,

      the QScreen class could help you

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Adam
        wrote on last edited by
        #3

        Thanks for the reply fecub.

        My problem is with the QScreen class. qApp->primaryScreen() returns a pointer to QScreen and I am using the function geometry() to find out the size but it is not the actual pixels of the device rather the "window" which is the full screen minus the navigation bar.

        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