From 7ccffa24be0d255d6d990a5a24df70d05d0c7c5d Mon Sep 17 00:00:00 2001 From: Mariano Reingart Date: Mon, 29 Sep 2014 04:26:50 +0000 Subject: [PATCH] Allow setting font and brush in DC when the qt painter is not active in wxQT, thanks @seandpagnier git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77937 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/qt/dc.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qt/dc.cpp b/src/qt/dc.cpp index 246a5b38cd..807eff068b 100644 --- a/src/qt/dc.cpp +++ b/src/qt/dc.cpp @@ -63,6 +63,7 @@ void wxQtDCImpl::QtPreparePainter( ) { m_qtPainter->setPen( wxPen().GetHandle() ); m_qtPainter->setBrush( wxBrush().GetHandle() ); + m_qtPainter->setFont( wxFont().GetHandle() ); } else { @@ -105,8 +106,9 @@ wxSize wxQtDCImpl::GetPPI() const void wxQtDCImpl::SetFont(const wxFont& font) { m_font = font; - - m_qtPainter->setFont(font.GetHandle()); + + if (m_qtPainter->isActive()) + m_qtPainter->setFont(font.GetHandle()); } void wxQtDCImpl::SetPen(const wxPen& pen) @@ -153,7 +155,8 @@ void wxQtDCImpl::SetBackground(const wxBrush& brush) { m_backgroundBrush = brush; - m_qtPainter->setBackground(brush.GetHandle()); + if (m_qtPainter->isActive()) + m_qtPainter->setBackground(brush.GetHandle()); } void wxQtDCImpl::SetBackgroundMode(int mode)