Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qmainwindow resize to screen size
Hi I am using qmainwindow class, I have added some labels, frames and buttons to my centralwidget. Now I want to resize my gui and its contents(lables,frames,buttons) to screen size.
Can anyone please help me? Thanks in advance.
Use layouts to handle your widgets. All explained in the Layout Management chapter of Qt's documentation.
When I am selecting frames and trying to set layout it's not happening.
@DivyaMuthyala Please show your code else it is just impossible to say what is wrong!
yuvaram last edited by
Its better not to hard code any of your widget sizes within mainwindow.
setMinimumSize, setMaximumSize can be used.
Based on different screen size :
QRect rec = QApplication::desktop()->screenGeometry();
int height = rec.height();
int width = rec.width();
Hope this should help you.