QML on android does not fill the entire screen
-
I'm trying to write android apps in QML, so I followed the official guides, but I have this problem:
with this simple code:import QtQuick import QtQuick.Controls import QtQuick.Layouts Window { width: 640 height: 480 visible: true title: qsTr("hello world") Rectangle{ color: "red" anchors.fill: parent } }
I expected my entire screen to be covered by the application (except of course the bottom buttons and the top statusbar) but instead this is the result:
why is there that white line at the bottom? how can I cover it?
changing Window height and width or unspecifying those attributes doesn't change the resultthanks in advance!
-
I can confirm this on one of my phones. An annoying white background, while the palette doesn't have any white in it.
My other Android phones with the exact same binary do not have this issue.I'm thinking this is a bug in Qt.
-
Its a good question where it comes from. The actual resolution is quite different, but things like the aspect ratio is identical between the phones.
I'm not sure how a full screen image would not be full-screen..Here the screenshots, notice he similarity with your screenshot. ps. this uses a ApplicationWindow QML for top-level.
See album at https://imgur.com/a/GEO5aay
-
@tubbadu said in QML on android does not fill the entire screen:
import QtQuick
import QtQuick.Controls
import QtQuick.LayoutsWindow {
width: 640
height: 480
visible: true
title: qsTr("hello world")Rectangle{ color: "red" anchors.fill: parent }
}
can you try the following? My app has not border.import QtQuick import QtQuick.Controls import QtQuick.Layouts Window { visible: true visibility: Window.FullScreen title: qsTr("hello world") Rectangle{ color: "red" anchors.fill: parent } }
-
@tubbadu said in QML on android does not fill the entire screen:
import QtQuick
import QtQuick.Controls
import QtQuick.LayoutsWindow {
width: 640
height: 480
visible: true
title: qsTr("hello world")Rectangle{ color: "red" anchors.fill: parent }
}
can you try the following? My app has not border.import QtQuick import QtQuick.Controls import QtQuick.Layouts Window { visible: true visibility: Window.FullScreen title: qsTr("hello world") Rectangle{ color: "red" anchors.fill: parent } }
@JoeCFD said in QML on android does not fill the entire screen:
visibility: Window.FullScreen
yeah this allowed my app to be real fullscreen without showing that ugly while line! thank you!
this btw hides the system buttons and the top notification bar, which I'd like to see in my application. Until I'll find a fix I'll use this workaround, thanks you very much!
-
@JoeCFD said in QML on android does not fill the entire screen:
visibility: Window.FullScreen
yeah this allowed my app to be real fullscreen without showing that ugly while line! thank you!
this btw hides the system buttons and the top notification bar, which I'd like to see in my application. Until I'll find a fix I'll use this workaround, thanks you very much!
-
@tubbadu for that you may try:
Window { width: Screen.width height: Screen.height }
but remove visibility: Window.FullScreen
-
@JoeCFD sadly this didn't work :(
Window's height and width attributes seems to have no effect at all in android application, I can set them to 1 or 1000000 or do not set them at all, but nothing changes, always that white line@tubbadu sorry. I did it long ago and sort of forgot it wile I did not need it. Try
Window { minimumWidth: Screen.width minimumHeight: Screen.height }
if it does not work, add
Window { minimumWidth: Screen.width minimumHeight: Screen.height maximumWidth: Screen.width maximumHeight: Screen.height }
-
@tubbadu sorry. I did it long ago and sort of forgot it wile I did not need it. Try
Window { minimumWidth: Screen.width minimumHeight: Screen.height }
if it does not work, add
Window { minimumWidth: Screen.width minimumHeight: Screen.height maximumWidth: Screen.width maximumHeight: Screen.height }
-
@JoeCFD nothing to do... always that awful white line :(
thanks for your efforts, I really appreciate!
-
@tubbadu Just tested my app. I can see the bottom, but not the top bar. However, I can not see the white line.
ApplicationWindow { minimumWidth: Screen.width minimumHeight: Screen.height }
Replace Window with ApplicationWindow
-
-
@JoeCFD I'm using Qt 6.2 in android 10, I'll try to compile it in Qt 5 and see what will happen
-
I found a 3rd phone that has an even taller white line.
The reference to Screen.width etc did give me an idea.
I created a big empty app and just a label with those numbers printed in the center.The fun result is that I got the low-res number. Not the actual number. (360 x 780 instead of 720x1560).
And I got the exact same number on both phones, including the one with the white.So, next step. Show the size of my big empty app. It gives me 360x706 on the phone where I do not have a white bar.
The one with the white bar gives me 360x686.So, concluding, the "Screen" part is irrelevant here as that is the 'fullscreen' size. Additionally, this is a problem that looks like it can not be solved from QML as we simply don't get the full graphics area to draw on...
So, lets try a simple QtGui-only app. No QML. Just a QWindow. Darn, no clue how to draw on that. Ok, QWidget it is. And, voila. same problem there...This is not a QML issue. I'm 90% certain this is a bug in Qt (QWindow, or more likely some Android specific thing code or plugin).
-
I found a 3rd phone that has an even taller white line.
The reference to Screen.width etc did give me an idea.
I created a big empty app and just a label with those numbers printed in the center.The fun result is that I got the low-res number. Not the actual number. (360 x 780 instead of 720x1560).
And I got the exact same number on both phones, including the one with the white.So, next step. Show the size of my big empty app. It gives me 360x706 on the phone where I do not have a white bar.
The one with the white bar gives me 360x686.So, concluding, the "Screen" part is irrelevant here as that is the 'fullscreen' size. Additionally, this is a problem that looks like it can not be solved from QML as we simply don't get the full graphics area to draw on...
So, lets try a simple QtGui-only app. No QML. Just a QWindow. Darn, no clue how to draw on that. Ok, QWidget it is. And, voila. same problem there...This is not a QML issue. I'm 90% certain this is a bug in Qt (QWindow, or more likely some Android specific thing code or plugin).
-
@JoeCFD said in QML on android does not fill the entire screen:
visibility: Window.FullScreen
yeah this allowed my app to be real fullscreen without showing that ugly while line! thank you!
this btw hides the system buttons and the top notification bar, which I'd like to see in my application. Until I'll find a fix I'll use this workaround, thanks you very much!
-
@TomZ Good tests! One way to work around this is to get display size from Java code and resize qml window to that size.