本文整理汇总了Python中PyQt4.QtGui.QGraphicsSimpleTextItem.mapToParent方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsSimpleTextItem.mapToParent方法的具体用法?Python QGraphicsSimpleTextItem.mapToParent怎么用?Python QGraphicsSimpleTextItem.mapToParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsSimpleTextItem
的用法示例。
在下文中一共展示了QGraphicsSimpleTextItem.mapToParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showMoveHelper
# 需要导入模块: from PyQt4.QtGui import QGraphicsSimpleTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsSimpleTextItem import mapToParent [as 别名]
def showMoveHelper(self, visible=True):
"""show help text In empty HandBoards"""
if visible:
if not self.__moveHelper:
splitter = QGraphicsRectItem(self)
hbCenter = self.rect().center()
splitter.setRect(hbCenter.x() * 0.5, hbCenter.y(), hbCenter.x() * 1, 1)
helpItems = [splitter]
for name, yFactor in [(m18n('Move Exposed Tiles Here'), 0.5),
(m18n('Move Concealed Tiles Here'), 1.5)]:
helper = QGraphicsSimpleTextItem(name, self)
helper.setScale(3)
nameRect = QRectF()
nameRect.setSize(helper.mapToParent(helper.boundingRect()).boundingRect().size())
center = QPointF(hbCenter)
center.setY(center.y() * yFactor)
helper.setPos(center - nameRect.center())
if self.sceneRotation() == 180:
rotateCenter(helper, 180)
helpItems.append(helper)
self.__moveHelper = self.scene().createItemGroup(helpItems)
self.__moveHelper.setVisible(True)
else:
if self.__moveHelper:
self.__moveHelper.setVisible(False)