Layout Problem
-
-
mrjj Lifetime Qt Championreplied to Taz742 on 1 Apr 2017, 15:24 last edited by mrjj 4 Jan 2017, 15:25
@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.
-
@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. -
There is no automatic resize of window. You must get adjust height yourself.
Post 2 of 10