[Not Answered] How to handle GUI objects sizes for different screen resolutions?
I am developing an application on my Laptop using the form classes for GUI Windows/Dialogs.
Every object inside the parent window/dialog has the default settings for size & I am using Layouts & Spacers as advised in a previous thread.
I am only hard coding the size of the parent window according to what I feel is good on my Laptop.
When I run the application on my Desktop (has a slightly different screen resolution), the Main Window does not fit in the screen.
So I decided to resize every window depending upon a ratio between the resolution of my laptop & the users resolution.
Example, a window of size 800x400 on my laptop(1000x800) will be 400x200 on my desktop(500x400) <numbers are imaginary for sake of understanding>.
I am calculating this ratio at startup using data from QDesktop object.
I would like to know whether my approach is correct?
If not then what is the standard practise?
Still no answer yet.... :(
I developed many applications with Qt and I never had to worry about the size of my windows.. Why do you absolutely want to keep a perfectly calculated ratio and everything?
If you REALLY want a special ratio, try using setFixedSize() or resize()
As I said I had chosen the sizes of my windows according to what was looking good on my laptop. But when I ran my application on my desktop, the size of my main window was much larger than the screen resolution, so part of it was not visible.
That is why I thought it was best to give sizes for main window's according to the users resolution.
Did you try running your applications on different screen resolutions?
What were your findings?
You should use Layout for managing display GUI in different resolutions.
Yes I am using Layout's for managing displaying of child widgets in a window.
But the main window still needs some size right?
I am talking about the size of parent window only & not the child widgets inside it.
If I am still wrong then does that mean you absolutely dont specify the size of your main window by code at all?
I did this because it shows the size of the window in the .ui designer.
The size becomes bold, so it will use the same size on all environments irrespective of the users resolution, right?