本文整理汇总了Python中PyQt4.QtGui.QGraphicsItem.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsItem.__init__方法的具体用法?Python QGraphicsItem.__init__怎么用?Python QGraphicsItem.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsItem
的用法示例。
在下文中一共展示了QGraphicsItem.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, scene, axis, posModel):
QGraphicsItem.__init__(self, scene=scene)
self.setFlag(QGraphicsItem.ItemHasNoContents);
self.axis = axis
self.posModel = posModel
self._width = 0
self._height = 0
self.thick_penX = QPen(Qt.red, self.thick_width)
self.thick_penX.setCosmetic(True)
self.thick_penY = QPen(Qt.green, self.thick_width)
self.thick_penY.setCosmetic(True)
self.thin_penX = QPen(Qt.red, self.thin_width)
self.thin_penX.setCosmetic(True)
self.thin_penY = QPen(Qt.green, self.thin_width)
self.thin_penY.setCosmetic(True)
self.x = 0
self.y = 0
# These child items do most of the work.
self._horizontal_marker = SliceMarkerLine(self, 'horizontal')
self._vertical_marker = SliceMarkerLine(self, 'vertical')
# We
self._horizontal_marker = SliceMarkerLine(self, 'horizontal')
self._vertical_marker = SliceMarkerLine(self, 'vertical')
示例2: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, scale, source, target, parent=None):
QGraphicsItem.__init__(self, parent)
self.source = source
self.target = target
self.scale = scale
self.updateShape()
self.setZValue(2)
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, scene, axis, crop_extents_model, editable=True):
self._cropColor = Qt.white
self._editable = editable
QGraphicsItem.__init__(self, scene=scene)
self.setFlag(QGraphicsItem.ItemHasNoContents);
self.setAcceptHoverEvents(True)
self.scene = scene
self.axis = axis
self.crop_extents_model = crop_extents_model
self.crop_extents_model.editableChanged.connect( self.onEditableChanged)
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
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, scene, axis, posModel):
"""
scene: Must be an ImageScene2D instance. We manipulate the scene.allow_brushing flag.
"""
QGraphicsItem.__init__(self, scene=scene)
self.setFlag(QGraphicsItem.ItemHasNoContents);
self.axis = axis
self.posModel = posModel
self._width = 0
self._height = 0
self.thick_penX = QPen(Qt.red, self.thick_width)
self.thick_penX.setCosmetic(True)
self.thick_penY = QPen(Qt.green, self.thick_width)
self.thick_penY.setCosmetic(True)
self.thin_penX = QPen(Qt.red, self.thin_width)
self.thin_penX.setCosmetic(True)
self.thin_penY = QPen(Qt.green, self.thin_width)
self.thin_penY.setCosmetic(True)
self.x = 0
self.y = 0
# These child items do most of the work.
self._horizontal_marker = SliceMarkerLine(self, 'horizontal')
self._vertical_marker = SliceMarkerLine(self, 'vertical')
示例5: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, unit):
QGraphicsItem.__init__(self)
self.unit = unit
self.yPosition = unit * 0.03
self.width = -self.unit * 0.02
self.lengthInUnits = 200
self.axisLength = self.lengthInUnits * unit
self.axisStart = -self.axisLength / 2
示例6: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, tile):
QGraphicsItem.__init__(self)
self._tile = weakref.ref(tile) # avoid circular references for easier gc
self._boundingRect = None
self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
# while moving the tile we use ItemCoordinateCache, see
# Tile.setActiveAnimation
self.setClippingFlags()
示例7: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self):
QGraphicsItem.__init__(self)
self.__selected = None
self.setZValue(3.0)
self.__mark = EDraw.Circle(10, 3, 90).translated(QPointF(0.0, -12.0))
self.__pen = EDraw.EColor.DefaultEnterHoverPen
示例8: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, parent=None, graphicView=None, graphicScene=None):
QGraphicsItem.__init__(self)
self.set_default_data()
self.className = QGraphicsTextItem(self)
self.functionsItem = FunctionsContainerModel(self)
self.className.setPlainText(self.defaultClassName)
self.setFlag(self.ItemIsMovable)
self.setFlag(self.ItemSendsGeometryChanges)
self.functionsItem.setPos(0, self.__get_title_height())
self.attributesItem = FunctionsContainerModel(self)
self.attributesItem.setPos(0, self.functionsItem.get_height())
示例9: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, parent, direction, index):
assert isinstance(parent, CroppingMarkers)
assert direction in ('horizontal', 'vertical')
self._parent = parent
self._direction = direction
self._index = index
QGraphicsItem.__init__(self, parent)
self.setAcceptHoverEvents(True)
self._position = 0
示例10: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, target, tail_length = 3):
# super params (x, y, width, height)
QGraphicsItem.__init__(self)
self._is_selected=False
self.history = History() # used to store the previous points where the target has been
self.tail_length = tail_length
self.target = target
self.plane = PlaneView(self)
# self.speed_vector = LineItem(parent = self.plane)
self.label=TargetLabel(parent = self.plane)
self.box_line = LineItem(parent = self.plane)
示例11: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, start, end, pen = QPen(QColor(0,0,0,255))):
self.pen = pen
QGraphicsItem.__init__(self)
self.starting_line = QLineF(start, end)
self.bounds = QRectF(
start - (end - start),
end + (end - start))
self.steps = 4
self.smooth = 50
self.dampen = 100
self.update_lines()
示例12: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, line_length, offset, linespace, align, hyphenate, block_id):
QGraphicsItem.__init__(self)
self.line_length, self.offset, self.line_space = line_length, offset, linespace
self.align, self.hyphenate, self.block_id = align, hyphenate, block_id
self.tokens = collections.deque()
self.current_width = 0
self.length_in_space = 0
self.height, self.descent, self.width = 0, 0, 0
self.links = collections.deque()
self.current_link = None
self.valign = None
if not hasattr(self, 'children'):
self.children = self.childItems
示例13: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, x1, y1, x2, y2, parent=None, scene=None):
QGraphicsItem.__init__(self, x1, y1, x2, y2,
parent=parent, scene=scene)
self.selec = False
self.ctrlPressed = False
self.selectWidth = 2.5
self.id = None
self.parentSelected = False
self.parentList = []
self.allItems = []
self.backupPen = self.pen()
self.select_pen = QPen(QtCore.Qt.gray)
self.select_pen.setStyle(QtCore.Qt.DotLine)
self.select_pen.setWidthF(self.selectWidth)
示例14: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self):
QGraphicsItem.__init__(self)
self.width = 0
self.height = 0
self.penX = QPen(Qt.red, 2)
self.penX.setCosmetic(True)
self.penY = QPen(Qt.green, 2)
self.penY.setCosmetic(True)
self.x = 0
self.y = 0
self.isVisible = False
示例15: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsItem import __init__ [as 别名]
def __init__(self, parent=None, icon=None, iconSize=None, **kwargs):
QGraphicsItem.__init__(self, parent, **kwargs)
self.setFlag(QGraphicsItem.ItemUsesExtendedStyleOption, True)
if icon is None:
icon = QIcon()
if iconSize is None:
style = QApplication.instance().style()
size = style.pixelMetric(style.PM_LargeIconSize)
iconSize = QSize(size, size)
self.__transformationMode = Qt.SmoothTransformation
self.__iconSize = QSize(iconSize)
self.__icon = QIcon(icon)