Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get screen resolution from android devlce



  • I am trying to make a game for android. And I use qpainterpath class for my moving objects but all screens have different resolutions. So I use

    ScrW = qdesktopwidget::screensize.width;

    ScrH = qdesktopwidget::screensize.height;

    And used my staff that Proportional for example

    Box.addrect(x,y, scrW/10, scrH/12)

    To create a box but it doesn't work all devices, my stuff gets different ratio espacially text are get crazy because it's font size.

    NewBoxText.addText ("example");

    Is there anyway to do that easyly and perfect image.

    Maybe I can solve really good proportional calculation and get a little bite better but some of my stuff goes out side of screen so I think I couldn't get the right resolution. So it's get crazy a bite.

    I m new that stuff if u can give me and advise it will be pleasure for me.

    Thanks.


Log in to reply