Reputation: 149
When you create a default QML application with the Qt SDK for Android your application always starts as small window. Normally a showExpanded or showFullscreen helps but this results in a black screen. The only way to work around is to use setGeometry with a fixed size, but this not very useful for supporting the big variety of Android devices. I somewhere found someone mentioning that the geometry is not correctly recognized by QML at startup and needs to be manually updated using the QDesktopWidget. Here the quote:
Application starts in “window” mode (with top panel) At start Qt components gets wrong screen size After load Qt gets correct screen size but QML not How to get correct screen size: Connect to signal QDesktopWidget::workAreaResized() Send to QML new screen size from QDesktopWidget::screenGeometry()
Has someone aleady experienced similar poblems? Btw. I use a splashscreen at startup but I had no poblem with the old Necessitas and on other platforms.
Upvotes: 1
Views: 1843
Reputation: 11
I'm working on qml apps on android devices.
include <QGuiApplication>
include <QtQml/QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc,argv);
QQmlApplicationEngine engine;
engine.load(QUrl("qrc:///main.qml"));
return app.exec();
}
(this is my main.cpp) and my main.qml is:
import QtQuick 2.1
import QtQuick.Controls 1.0
ApplicationWindow {
id: mainWin
visible: true
...
...
with the above code my app fits full screen on android and i can get the screen size with mainWin.width and mainWin.height.
Upvotes: 1