e53c2165e6
- added workaround for Qt bug: https://bugreports.qt-project.org/browse/QTBUG-18616 - allow pxMode argument in PlotDataItem.setData()
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from pyqtgraph.Qt import QtGui, QtCore
|
|
from .GraphicsItem import GraphicsItem
|
|
|
|
__all__ = ['GraphicsObject']
|
|
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>`)
|
|
"""
|
|
def __init__(self, *args):
|
|
QtGui.QGraphicsObject.__init__(self, *args)
|
|
GraphicsItem.__init__(self)
|
|
|
|
def itemChange(self, change, value):
|
|
ret = QtGui.QGraphicsObject.itemChange(self, change, value)
|
|
if change in [self.ItemParentHasChanged, self.ItemSceneHasChanged]:
|
|
self._updateView()
|
|
return ret
|
|
|
|
|
|
|
|
def setParentItem(self, parent):
|
|
## Workaround for Qt bug: https://bugreports.qt-project.org/browse/QTBUG-18616
|
|
pscene = parent.scene()
|
|
if pscene is not None and self.scene() is not pscene:
|
|
pscene.addItem(self)
|
|
return QtGui.QGraphicsObject.setParentItem(self, parent)
|