Allow SetFont to be called before Create in wxQT, thanks @seandepagnier

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mariano Reingart 2014-09-29 03:12:59 +00:00
parent b922ee8ac9
commit ab7e49deb8

View File

@ -274,6 +274,7 @@ void wxWindowQt::PostCreation(bool generic)
SetBackgroundColour(wxColour(GetHandle()->palette().background().color()));
SetForegroundColour(wxColour(GetHandle()->palette().foreground().color()));
GetHandle()->setFont( wxWindowBase::GetFont().GetHandle() );
}
void wxWindowQt::AddChild( wxWindowBase *child )
@ -422,9 +423,16 @@ void wxWindowQt::Refresh( bool WXUNUSED( eraseBackground ), const wxRect *rect )
bool wxWindowQt::SetFont( const wxFont &font )
{
GetHandle()->setFont( font.GetHandle() );
return ( true );
// SetFont may be called before Create, so the font is stored
// by the base class, and set in PostCreation
if (GetHandle())
{
GetHandle()->setFont( font.GetHandle() );
return true;
}
return wxWindowBase::SetFont(font);
}