本文整理汇总了Python中PyQt5.QtWidgets.QGraphicsItem.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsItem.__init__方法的具体用法?Python QGraphicsItem.__init__怎么用?Python QGraphicsItem.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QGraphicsItem
的用法示例。
在下文中一共展示了QGraphicsItem.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsItem import __init__ [as 别名]
def __init__(self, axis, crop_extents_model, editable=True):
self._cropColor = Qt.white
QGraphicsItem.__init__(self)
self.setFlag(QGraphicsItem.ItemHasNoContents)
self.setAcceptHoverEvents(True)
self.axis = axis
self.crop_extents_model = crop_extents_model
self._width = 0
self._height = 0
# Add shading item first so crop lines are drawn on top.
self._shading_item = ExcludedRegionShading(self, self.crop_extents_model)
self._horizontal0 = CropLine(self, "horizontal", 0)
self._horizontal1 = CropLine(self, "horizontal", 1)
self._vertical0 = CropLine(self, "vertical", 0)
self._vertical1 = CropLine(self, "vertical", 1)
self.crop_extents_model.changed.connect(self.onExtentsChanged)
self.crop_extents_model.colorChanged.connect(self.onColorChanged)
# keeping track which line started mouse move
self._mouseMoveStartH = -1
self._mouseMoveStartV = -1
self._fractionOfDistance = 1
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsItem import __init__ [as 别名]
def __init__(self, nr, closed, parentEntity):
QGraphicsItem.__init__(self)
Shape.__init__(self, nr, closed, parentEntity)
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.setAcceptedMouseButtons(QtCore.Qt.NoButton)
self.selectionChangedCallback = None
self.enableDisableCallback = None
self.starrow = None
self.enarrow = None
示例3: __init__
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsItem import __init__ [as 别名]
def __init__(self):
QGraphicsItem.__init__(self)
self._width = 0
self._height = 0
self.penDotted = QPen(Qt.red, 2, Qt.DotLine, Qt.RoundCap, Qt.RoundJoin)
self.penDotted.setCosmetic(True)
self.penSolid = QPen(Qt.red, 2)
self.penSolid.setCosmetic(True)
self.x = 0
self.y = 0
self.brushSize = 0
self.mode = self.modeXYPosition
self._enabled = True
示例4: __init__
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsItem import __init__ [as 别名]
def __init__(self, text='S', startp=Point(x=0.0, y=0.0),):
"""
Initialisation of the class.
"""
QGraphicsItem.__init__(self)
self.setFlag(QGraphicsItem.ItemIsSelectable, False)
self.text = text
self.sc = 1.0
self.startp = QtCore.QPointF(startp.x, -startp.y)
pencolor = QColor(0, 200, 255)
self.brush = QColor(0, 100, 255)
self.pen = QPen(pencolor, 1, QtCore.Qt.SolidLine)
self.pen.setCosmetic(True)
self.path = QPainterPath()
self.path.addText(QtCore.QPointF(0, 0),
QFont("Arial", 10/self.sc),
self.text)
示例5: __init__
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsItem import __init__ [as 别名]
def __init__(self, index):
Node.__init__(self, index)
QGraphicsItem.__init__(self)
# 绘制时的位置
self.index_draw = 0