Discover full screen resolution of Android Device in Immersive mode
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?
Hi Adam and welcome,
the QScreen class could help you
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.