Implement wxFrame::DoSetClientSize()

Resize the central widget to fit the new size.

See https://github.com/wxWidgets/wxWidgets/pull/1340
This commit is contained in:
Liam Treacy 2019-06-04 16:02:41 +01:00 committed by Vadim Zeitlin
parent b8d5c85ecb
commit 4bfb3a5f01
2 changed files with 14 additions and 0 deletions

View File

@ -56,6 +56,7 @@ public:
protected:
virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE;
virtual void DoSetClientSize(int width, int height) wxOVERRIDE;
virtual QWidget* QtGetParentWidget() const wxOVERRIDE;

View File

@ -231,6 +231,19 @@ void wxFrame::DoGetClientSize(int *width, int *height) const
}
}
void wxFrame::DoSetClientSize(int width, int height)
{
wxWindow::DoSetClientSize(width, height);
int adjustedWidth, adjustedHeight;
DoGetClientSize(&adjustedWidth, &adjustedHeight);
QWidget *centralWidget = GetQMainWindow()->centralWidget();
QRect geometry = centralWidget->geometry();
geometry.setSize(QSize(adjustedWidth, adjustedHeight));
centralWidget->setGeometry(geometry);
}
QMainWindow *wxFrame::GetQMainWindow() const
{
return static_cast<QMainWindow*>(m_qtWindow);