Skip to content

Qt4agg draw #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions lib/matplotlib/backends/backend_qt4agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def __init__( self, figure ):
self.drawRect = False
self.rect = []
self.blitbox = None
self.replot = True
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)

def drawRectangle( self, rect ):
Expand All @@ -69,7 +68,7 @@ def drawRectangle( self, rect ):

def paintEvent( self, e ):
"""
Draw to the Agg backend and then copy the image to the qt.drawable.
Copy the image from the Agg canvas to the qt.drawable.
In Qt, all drawing should be done inside of here when a widget is
shown onscreen.
"""
Expand All @@ -78,10 +77,6 @@ def paintEvent( self, e ):
if DEBUG: print 'FigureCanvasQtAgg.paintEvent: ', self, \
self.get_width_height()

if self.replot:
FigureCanvasAgg.draw(self)
self.replot = False

if self.blitbox is None:
# matplotlib is in rgba byte order. QImage wants to put the bytes
# into argb format and is in a 4 byte unsigned int. Little endian
Expand Down Expand Up @@ -121,11 +116,13 @@ def paintEvent( self, e ):

def draw( self ):
"""
Draw the figure when xwindows is ready for the update
Draw the figure with Agg, and queue a request
for a Qt draw.
"""

if DEBUG: print "FigureCanvasQtAgg.draw", self
self.replot = True
# The Agg draw is done here; delaying it until the paintEvent
# causes problems with code that uses the result of the
# draw() to update plot elements.
FigureCanvasAgg.draw(self)
self.update()

def blit(self, bbox=None):
Expand Down