Skip to content

remove .rect member (clashes with QWidget) #2946

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 3 commits into from
Apr 27, 2014
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ original location:
* Removed the class `FigureManagerQTAgg` and deprecated `NavigationToolbar2QTAgg`
which will be removed in 1.5.

* Removed formerly public (non-prefixed) attributes `rect` and
`drawRect` from `FigureCanvasQTAgg`; they were always an
implementation detail of the (preserved) `drawRectangle()` function.

* The function signatures of `tight_bbox.adjust_bbox` and
`tight_bbox.process_figure_for_rasterizing` have been changed. A new
`fixed_dpi` parameter allows for overriding the `figure.dpi` setting
Expand Down
14 changes: 6 additions & 8 deletions lib/matplotlib/backends/backend_qt4agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,12 @@ def __init__(self, figure):
print('FigureCanvasQtAgg: ', figure)
FigureCanvasQT.__init__(self, figure)
FigureCanvasAgg.__init__(self, figure)
self.drawRect = False
self.rect = []
self._drawRect = None
self.blitbox = None
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)

def drawRectangle(self, rect):
self.rect = rect
self.drawRect = True
self._drawRect = rect
self.repaint()

def paintEvent(self, e):
Expand Down Expand Up @@ -115,10 +113,10 @@ def paintEvent(self, e):
p.drawPixmap(QtCore.QPoint(0, 0), QtGui.QPixmap.fromImage(qImage))

# draw the zoom rectangle to the QPainter
if self.drawRect:
if self._drawRect is not None:
p.setPen(QtGui.QPen(QtCore.Qt.black, 1, QtCore.Qt.DotLine))
p.drawRect(self.rect[0], self.rect[1],
self.rect[2], self.rect[3])
x, y, w, h = self._drawRect
p.drawRect(x, y, w, h)
p.end()

# This works around a bug in PySide 1.1.2 on Python 3.x,
Expand All @@ -143,7 +141,7 @@ def paintEvent(self, e):
p.drawPixmap(QtCore.QPoint(l, self.renderer.height-t), pixmap)
p.end()
self.blitbox = None
self.drawRect = False
self._drawRect = None

def draw(self):
"""
Expand Down