Fix problem with clipping region in wxqt.
QPainter cannot set the clipping region when it is not active. Thanks @seandepagnier git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,6 +64,20 @@ void wxQtDCImpl::QtPreparePainter( )
|
||||
m_qtPainter->setPen( wxPen().GetHandle() );
|
||||
m_qtPainter->setBrush( wxBrush().GetHandle() );
|
||||
m_qtPainter->setFont( wxFont().GetHandle() );
|
||||
|
||||
if (m_clipping)
|
||||
{
|
||||
wxRegionIterator ri(*m_clippingRegion);
|
||||
bool append = false;
|
||||
while (ri.HaveRects())
|
||||
{
|
||||
wxRect r = ri.GetRect();
|
||||
m_qtPainter->setClipRect( r.x, r.y, r.width, r.height,
|
||||
append ? Qt::IntersectClip : Qt::ReplaceClip );
|
||||
append = true;
|
||||
ri++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -347,9 +361,12 @@ void wxQtDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y,
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set QPainter clipping (intersection if not the first one)
|
||||
m_qtPainter->setClipRect( x, y, width, height,
|
||||
m_clipping ? Qt::IntersectClip : Qt::ReplaceClip );
|
||||
if (m_qtPainter->isActive())
|
||||
{
|
||||
// Set QPainter clipping (intersection if not the first one)
|
||||
m_qtPainter->setClipRect( x, y, width, height,
|
||||
m_clipping ? Qt::IntersectClip : Qt::ReplaceClip );
|
||||
}
|
||||
|
||||
// Set internal state for getters
|
||||
/* Note: Qt states that QPainter::clipRegion() may be slow, so we
|
||||
@@ -414,7 +431,9 @@ void wxQtDCImpl::DestroyClippingRegion()
|
||||
{
|
||||
ResetClipping();
|
||||
m_clippingRegion->Clear();
|
||||
m_qtPainter->setClipping( false );
|
||||
|
||||
if (m_qtPainter->isActive())
|
||||
m_qtPainter->setClipping( false );
|
||||
}
|
||||
|
||||
bool wxQtDCImpl::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
|
||||
|
Reference in New Issue
Block a user