Qt layouts - Keep widget aspect ratio while resizing [duplicate]
问题 This question already has answers here : How to maintain widgets aspect ratio in Qt? (4 answers) Closed 5 years ago . I want to keep an aspect ratio of 16/9 on a QGroupBox (the one on the left on the screenshot below). For the tests I made a simple program with 4 groupboxes in a vertical layout, all in an horizontal layout: main.cpp #include "MainWindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }