Solved Fullscreen app on android
-
Hi there,
How set a QT app as fullscreen on android?
Thanks
-
@scotryder get working space geometry as
screengeo = QApplication::desktop()->availableGeometry();
then calculate zoom factor to fill geometry by vertical or horizontal and then scale to this factor.
-
Thank you for your reply
Im using a QML based app (should have mentioned earlier) and was expecting something simple :( -
I have a QML&C++ application on Android and I'm pretty sure the only thing I do to fullscreen it (hiding the status bar) is invoke
showFullScreen()
on theQQuickView
mymain.cpp
creates. At least that's been true from Qt5.7... think there might have been some problems/a different way of doing it back around Qt5.3.If your app is just QML see https://forum.qt.io/topic/77517/android-fullscreen-app
It's more complicated on iOS where you have to set some plist property.
-
@timday said in Fullscreen app on android:
Thats a reply i was expecting, Here is my main.cpp but i dont see QQuickView in it, please advise
int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QtWebView::initialize(); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
-
Hmmm interesting... there's probably lots of ways of doing it but my own minimal canonical QML-based app looks like:
int main(int argc,char* argv[]) { QGuiApplication app(argc,argv); QQuickView viewer; viewer.setResizeMode(QQuickView::SizeRootObjectToView); viewer.setSource(QUrl("qrc:///main.qml")); viewer.showFullScreen(); return app.exec(); }
If you need to get hold of the QML engine, it lives at
viewer.engine()
. I'm a bit surprised your way of doing things works at all actually... my assumption would have been you always have to call one of theshow
methods on some graphical class to have an app display anything at all! -
Interestingly this is autogenerated code when i create a new QT Quick App. However i just tried your visiblity fix from other post you mentioned, and gonna give it a try and if it works ill set this as answer.
Thank you very much :)