Important: Please read the Qt Code of Conduct -

Size of a dialog box

  • Greetings.

    Implement a dialog box for an application and it works pretty well. I work with a laptop, and run my program on another computer the dialog box looks considerably larger (but still works well).

    The other machine monitor is larger and possibly has a different screen resolution (I have insurance).

    My question is: is it possible to make the dialog box always looks the same (ie proportionally occupy the same screen space) regardless of size and resolution of the screen?

    Thanks in advance for any help and/or suggestions.

  • Hi,
    I think the easiest way to do this is to read out the height/width of your mainwindow (or the window the dialog is placed on) and then convert this to a dialog height/width and set the size accordingly. This is still platform independent. You could also request the screen size from the OS, but then for iOS/Android/Win32 the interface is all different.

  • Thanks Greetz Jeroen.

    Initially had thought of that, ie give to the dialog box a size that is a percentage of the parent widget's size. I had to ask to know if there was another alternative.


Log in to reply