本文整理匯總了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)