2012-03-02 02:55:32 +00:00
|
|
|
from pyqtgraph.Qt import QtGui, QtCore
|
2012-05-11 22:05:41 +00:00
|
|
|
from .GraphicsItem import GraphicsItem
|
2012-03-02 02:55:32 +00:00
|
|
|
|
|
|
|
__all__ = ['GraphicsObject']
|
2012-04-16 20:45:55 +00:00
|
|
|
class GraphicsObject(GraphicsItem, QtGui.QGraphicsObject):
|
|
|
|
"""
|
|
|
|
**Bases:** :class:`GraphicsItem <pyqtgraph.graphicsItems.GraphicsItem>`, :class:`QtGui.QGraphicsObject`
|
|
|
|
|
|
|
|
Extension of QGraphicsObject with some useful methods (provided by :class:`GraphicsItem <pyqtgraph.graphicsItems.GraphicsItem>`)
|
2012-03-02 02:55:32 +00:00
|
|
|
"""
|
2012-06-18 23:40:15 +00:00
|
|
|
_qtBaseClass = QtGui.QGraphicsObject
|
2012-03-02 02:55:32 +00:00
|
|
|
def __init__(self, *args):
|
|
|
|
QtGui.QGraphicsObject.__init__(self, *args)
|
2012-10-31 05:57:00 +00:00
|
|
|
self.setFlag(self.ItemSendsGeometryChanges)
|
2012-04-16 20:45:55 +00:00
|
|
|
GraphicsItem.__init__(self)
|
2012-03-02 02:55:32 +00:00
|
|
|
|
2012-05-15 02:05:53 +00:00
|
|
|
def itemChange(self, change, value):
|
|
|
|
ret = QtGui.QGraphicsObject.itemChange(self, change, value)
|
|
|
|
if change in [self.ItemParentHasChanged, self.ItemSceneHasChanged]:
|
|
|
|
self._updateView()
|
2012-10-31 05:57:00 +00:00
|
|
|
if change in [self.ItemPositionHasChanged, self.ItemTransformHasChanged]:
|
|
|
|
self.informViewBoundsChanged()
|
2012-05-15 02:05:53 +00:00
|
|
|
return ret
|