本文整理汇总了Python中PyQt4.QtGui.QGraphicsTextItem.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsTextItem.__init__方法的具体用法?Python QGraphicsTextItem.__init__怎么用?Python QGraphicsTextItem.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsTextItem
的用法示例。
在下文中一共展示了QGraphicsTextItem.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsTextItem import __init__ [as 别名]
def __init__(self, canvas, text="", x=0, y=0,
alignment=Qt.AlignLeft | Qt.AlignTop, bold=0, font=None, z=0,
html_text=None, tooltip=None, show=1, vertical=False):
QGraphicsTextItem.__init__(self, text, None)
if font:
self.setFont(font)
if bold:
font = self.font()
font.setBold(bold)
self.setFont(font)
if html_text:
self.setHtml(html_text)
self.alignment = alignment
self.vertical = vertical
if vertical:
self.setRotation(-90)
self.setPos(x, y)
self.x, self.y = x, y
self.setZValue(z)
if tooltip:
self.setToolTip(tooltip)
if show:
self.show()
else:
self.hide()
if canvas is not None:
canvas.addItem(self)
示例2: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsTextItem import __init__ [as 别名]
def __init__(self, whex):
QGraphicsTextItem.__init__(self)
self.initValues(whex)
self.initPosition()
# self.initDocument()
self.initFont()
self.initMetricsValues()
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsTextItem import __init__ [as 别名]
def __init__(self, str0='', parent=None, scene=None):
QGraphicsTextItem.__init__ (self, str0, parent, scene)
self.setAcceptHoverEvents (False)
self.setAcceptedMouseButtons (Qt.NoButton)
self.setAcceptDrops (False)
self.setAcceptTouchEvents (False)
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsTextItem import __init__ [as 别名]
def __init__( self, edge ):
text = edge.label.replace( '\\n', '\n' )
QGraphicsTextItem.__init__( self, text )
font = QFont( "Arial", 10 )
self.setFont( font )
metric = QFontMetrics( font )
rec = metric.boundingRect( 0, 0, 10000, 10000, Qt.AlignCenter, text )
self.setPos( edge.labelX - rec.width() / 2,
edge.labelY - rec.height() / 2 )
# To make double click not delivered
self.setFlag( QGraphicsItem.ItemIsSelectable, False )
return
示例5: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsTextItem import __init__ [as 别名]
def __init__(self, whex):
QGraphicsTextItem.__init__(self)
self.initValues(whex)
# self.initShape()
self.initPosition()
self.initFont()
示例6: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsTextItem import __init__ [as 别名]
def __init__(self, *args, **kwargs):
QGraphicsTextItem.__init__(self, *args, **kwargs)
self.__placeholderText = ""
示例7: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsTextItem import __init__ [as 别名]
def __init__(self, text, parent=None):
QGraphicsTextItem.__init__ (self, text, parent)