Important: Please read the Qt Code of Conduct -

problem with Screen.width

  • Hello,

    I have an main app which run another app, I need to place this second app properly according to the main app. for this I use in my second app the code :
    x : Screen.width * 15/100
    y : Screen.height * 50/100

    and the app is properly located.

    My problem and that if I run my main app in another computer with a screen size different, the second app is wrong located when I run it.

    I suppose that during the compilation the variable Screen.width reccords the size of the screen currently, but how can I do to take the size of the screen when I run my second app whatever if I change of computer.

    I hope you understand my problem.


  • Qt Champions 2017

    During the compilation you cannot record the width and height of the screen. Best thing is that when the first app runs read the screen sizes and pass this as command line parameters to second app. Parameters you can pass are relative to first App.

Log in to reply