Make Reparent() work for wxFrame in wxQt

Use the correct parent window, i.e. the one of the central widget and
not of the frame itself.
This commit is contained in:
Vadim Zeitlin
2019-09-15 01:25:34 +02:00
parent 616fc76173
commit b8d5c85ecb
4 changed files with 15 additions and 2 deletions

View File

@@ -187,11 +187,16 @@ void wxFrame::SetWindowStyleFlag( long style )
GetQMainWindow()->setWindowFlags(qtFlags);
}
QWidget* wxFrame::QtGetParentWidget() const
{
return GetQMainWindow()->centralWidget();
}
void wxFrame::AddChild( wxWindowBase *child )
{
// Make sure all children are children of the central widget:
QtReparent( child->GetHandle(), GetQMainWindow()->centralWidget() );
QtReparent( child->GetHandle(), QtGetParentWidget() );
wxFrameBase::AddChild( child );
}

View File

@@ -437,7 +437,7 @@ bool wxWindowQt::Reparent( wxWindowBase *parent )
if ( !wxWindowBase::Reparent( parent ))
return false;
QtReparent( GetHandle(), parent->GetHandle() );
QtReparent( GetHandle(), static_cast<wxWindow*>(parent)->QtGetParentWidget() );
return true;
}