Important: Please read the Qt Code of Conduct -

Compute window size for a custom dialog based application

  • Hi

    I am writting in QML a dialog based application for multiple OSs (Windows, OSX, Linux). The problem I am facing is how to set the window size in order to have a pleasing aspect on different screens:
    I have tried the following:

    width: 55Screen.pixelDensity
    height: 110

    where 55x110 should be the desired window size in mm, but the resulting size is not fixed on different screen resolutions. Could you recommend another approach for computing the window size ?


  • Hi, I don't know if QML has simular events, but in C++ there are events/slots called (can't remember if it are slots or events):
    sizeForHeight and sizeForWidth
    There you're able to set the desired size for a set value.

  • Yes, but I am facing a different problem: how to compute width and height so that my window has the same size on different screen resolutions

Log in to reply