Reputation: 11436
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();
}
Upvotes: 0
Views: 550
Reputation: 5978
You may use resize(800, 600)
in the constructor instead of setMinimumSize
which creates limits.
By the way, although it's a common function, resize
is inherited from QWidget
and many people (me included) can't find it in the document page of QMainWindow
.
I think you are just one of the victims.
Thanks to lpapp's comment:
"Usually one can click on the List of all members, including inherited members
link to get to all the members of a class."
Upvotes: 2