Unsolved Layout Problem
-
So I have Form Layout, Here lies Widget.
The problem is the next, my screen size is 1920x1080 and And everything seems fine, but when start my program 1366x768 screen rezolution, The lower part cut.What can I do?
-
@Taz742
Resize the window?
Check resolution and resize your window to fit. if all in layouts - all widgets will resize.QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
int height = screenGeometry.height();
int width = screenGeometry.width(); -
@mrjj
QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
int height = screenGeometry.height();
int width = screenGeometry.width();
I got it correctly measures the resolution which I have now.
Now my mainwindow resize this screenGeometry? -
Hi,
The widgets have a minimum size that need to be respected. In you case you should maybe add a QScrollArea so the user can scroll through your UI if the screen resolution doesn't allow to show everything.
-
@SGaist
Yes I tried QScrollArea. But Normal Resolution i do not want to see ScrollArea.
It would be good if I will be able to appear and then when it's needed.
But I dont understand how to do it. -
@Taz742 You could have all the controls in the scrollarea and just hide the scrollbar when they are all visible. Then when the resolution is the smaller one where it is needed, it would show the scrollbar again.
So it would look normal like in your screenshot at 1080p but then have a scrollbar in the smaller resolution.
-
@ambershark
I believe scrollbar is only one solution? -
@Taz742
Hi
The scrollbar is one way yes. Maybe the best.Or you can simply resize the window in designer so it fits lower res.
Or do it runtime. -
@mrjj
automatic resize is something event? -
There is no automatic resize of window. You must get adjust height yourself.