本文整理匯總了Python中AnyQt.QtWidgets.QGraphicsTextItem.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python QGraphicsTextItem.__init__方法的具體用法?Python QGraphicsTextItem.__init__怎麽用?Python QGraphicsTextItem.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AnyQt.QtWidgets.QGraphicsTextItem
的用法示例。
在下文中一共展示了QGraphicsTextItem.__init__方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from AnyQt.QtWidgets import QGraphicsTextItem [as 別名]
# 或者: from AnyQt.QtWidgets.QGraphicsTextItem import __init__ [as 別名]
def __init__(self, scene, text="", x=0, y=0,
alignment=Qt.AlignLeft | Qt.AlignTop, bold=False, font=None,
z=0, html_text=None, tooltip=None, show=True, 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 scene is not None:
scene.addItem(self)
示例2: __init__
# 需要導入模塊: from AnyQt.QtWidgets import QGraphicsTextItem [as 別名]
# 或者: from AnyQt.QtWidgets.QGraphicsTextItem import __init__ [as 別名]
def __init__(self, parent, *args, **kwargs):
QGraphicsTextItem.__init__(self, *args)
GraphNode.__init__(self, **kwargs)
self._background_brush = None
self._rect = None
self.parent = parent
font = self.font()
font.setPointSize(10)
self.setFont(font)
self.droplet = GraphicsDroplet(-5, 0, 10, 10, self)
self.droplet.setPos(self.rect().center().x(), self.rect().height())
self.document().contentsChanged.connect(self.update_contents)
self.isOpen = True
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
示例3: __init__
# 需要導入模塊: from AnyQt.QtWidgets import QGraphicsTextItem [as 別名]
# 或者: from AnyQt.QtWidgets.QGraphicsTextItem import __init__ [as 別名]
def __init__(self, *args, **kwargs):
QGraphicsTextItem.__init__(self, *args, **kwargs)
self.setAcceptHoverEvents(True)
self.__placeholderText = ""
self.__editing = False # text editing in progress
示例4: __init__
# 需要導入模塊: from AnyQt.QtWidgets import QGraphicsTextItem [as 別名]
# 或者: from AnyQt.QtWidgets.QGraphicsTextItem import __init__ [as 別名]
def __init__(self, *args, **kwargs):
QGraphicsTextItem.__init__(self, *args, **kwargs)
self.__placeholderText = ""