super small resolution on android app
-
I'm new to Qt.
i created a simple app for android.
The resolution of my test android device is 1080 x 2400.
But the resolution of the app is somewhat 468x1000.How do i use the full resolution?
I tried some settings with screen.width ..
but it didnt work.code:
import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 ApplicationWindow { id: root width: 1080 height: 2160 //minimumWidth: Screen.width //minimumHeight: Screen.height //visibility: Window.FullScreen visible: true title: qsTr("Hello World") Rectangle{ width: 468 height:1000 color:"red" } }Is this a feature of a highDPI-Scaling ? if yes, how to disable it?
Or do i have to specify the resolution somewhere else? AndroidManifest - for example`?
Thank you.
-
The coordinate system in QML is not the same as the device pixels on the screen. The coordinates are floating point numbers and text and graphics are drawn using the full resolution of the device, no matter how you transform the coordinates. If you want to use pixel resolution for displaying an image resource, you can use QScreen::physicalDotsPerInch() etc to scale it to the right size. But it is better to make everything in your app scalable to work at any resolution.
-
thank you for your explanation. i totally agree with making everything scalable.
but for example
if i load a small image with 512x512 px its close to fullscreen
or
if i draw a rectangle with border.width:1 the border is super bold.to me it feels like the whole ui is upscaled 250% - that is to much.
the upscaling is a nice feature but should be optional.so, can we somehow change this upscaling?
thank you.
-
okay, after reading your comment again:
The coordinate system in QML is not the same as the device pixels on the screen.
I recognised my misconception. The use of "px" for defining the width and height of elements was misleading for me.
But, having width: 472 and height: 1016 of available space on my device seems arbitrary to me.
I get it, that i should always use scalable layouts - not specififc values, but still. -
I design my application in 360 x 720. Which makes the application look the same on all phones. Regardless of actual number of pixels of the screen.
The advantage is that you can use pixels for your design. Spacing is 10 pixels between components, for instance. Those are not real pixels, so the spacing will look the same on all devices.
Please do notice this is using Qt6.