I have the following problem.I have a QmainWindow which sets main layout and a widget added to that Layout. When I resize the widget the QmainWindows remains the same size.
Here is the setup: In the QmainWindow on init:
this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
m_mainLayout = new QVBoxLayout();
m_mainLayout->setAlignment(Qt::AlignHCenter);
m_centralWidget = new QWidget();
m_centralWidget->setLayout(m_mainLayout);
setCentralWidget(m_centralWidget);
this->setMinimumSize(800,600);
m_mainLayout->addWidget(m_GLWidget);
Then,at some point m_GLWidget signals it needs to be resized.QmainWindow catches the signal and
reized the m_GLWidget:
void MainWindow::ResizeViewportSlot(int w,int h){
m_GLWidget->setFixedSize(w,h);
m_GLWidget->updateGeometry();
this->updateGeometry();
}
QMainWindow
? – Tay2510resize(800, 600)
in the constructor instead ofsetMinimumSize
which creates limits. – Tay2510