Resolution problem for an Android application
-
Hello everyone,
I am developing an Android application using Qt Creator (a Qt widget with Qt 6.5) that will run only on a specific defined tablet (SAMSUNG with a resolution of 1920x1200). I would like to specify the dimensions of the components placed in the editor as actual pixel values of the tablet. Currently, if I specify, for example, a button of 500px x 500px, it gets scaled according to the DPI, becoming much larger and different from the same application running on Windows. How can I avoid this effect (which is not useful in my case)?
Thank you!
-
Hello everyone,
I am developing an Android application using Qt Creator (a Qt widget with Qt 6.5) that will run only on a specific defined tablet (SAMSUNG with a resolution of 1920x1200). I would like to specify the dimensions of the components placed in the editor as actual pixel values of the tablet. Currently, if I specify, for example, a button of 500px x 500px, it gets scaled according to the DPI, becoming much larger and different from the same application running on Windows. How can I avoid this effect (which is not useful in my case)?
Thank you!
@Giovanni-Goloso I ran into this same struggle a couple years ago.
I don't know if anyone has a better idea these days. (I would love to see if you get any other helpful replies). The tactic that I "invented" back then is described in the following StackOverflow answer:
https://stackoverflow.com/a/67511920/10278
As I explain on that StackOverflow post, I based my solution on this part of the Qt docs:
-
@Giovanni-Goloso I ran into this same struggle a couple years ago.
I don't know if anyone has a better idea these days. (I would love to see if you get any other helpful replies). The tactic that I "invented" back then is described in the following StackOverflow answer:
https://stackoverflow.com/a/67511920/10278
As I explain on that StackOverflow post, I based my solution on this part of the Qt docs:
@KH-219Design Hello and thank you for the response. I have read and tried the solution you provided carefully, but it's not exactly what I'm looking for. Let me explain why:
I need to render images on the screen, for example, 1000px by 500px. With your solution, I would have to scale these images by the 'm_extentsRatio' factor (sampling) and let Android then scale them to the actual 1000px by 500px (interpolation). We are developing critical systems, and interpolation is not allowed.
It seems to me that Android applies this scaling downstream based on DPI. I need to completely disable it for my application written in Qt, but unfortunately, I can't find anything! =(