def createContent(self): # Create the items. self.heading = HeadingItem(self.name, self.scene(), self) para1 = self.loadDescription(0, 1) if not para1: para1 = Colors.contentColor + "Could not load description. Ensure that the documentation for Qt is built." bgcolor = Colors.sceneBg1.darker(200) bgcolor.setAlpha(100) self.description1 = DemoTextItem(para1, Colors.contentFont(), Colors.heading, 500, self.scene(), self, DemoTextItem.STATIC_TEXT) self.description2 = DemoTextItem(self.loadDescription(1, 2), Colors.contentFont(), Colors.heading, 250, self.scene(), self, DemoTextItem.STATIC_TEXT) # Place the items on screen. self.heading.setPos(0, 3) self.description1.setPos( 0, self.heading.pos().y() + self.heading.boundingRect().height() + 10) self.description2.setPos( 0, self.description1.pos().y() + self.description1.boundingRect().height() + 15)
def setupSceneItems(self): if Colors.showFps: self.fpsLabel = DemoTextItem("FPS: --", Colors.buttonFont(), QtCore.Qt.white, -1, self.scene, None, DemoTextItem.DYNAMIC_TEXT) self.fpsLabel.setZValue(1000) self.fpsLabel.setPos( Colors.stageStartX, 600 - QtGui.QFontMetricsF(Colors.buttonFont()).height() - 5) self.mainSceneRoot = QtGui.QGraphicsWidget() self.scene.addItem(self.mainSceneRoot) self.companyLogo = ImageItem( QtGui.QImage(':/images/trolltech-logo.png'), 1000, 1000, self.scene, None, True, 0.5) self.qtLogo = ImageItem(QtGui.QImage(':/images/qtlogo_small.png'), 1000, 1000, self.scene, None, True, 0.5) self.companyLogo.setZValue(100) self.qtLogo.setZValue(100) self.pausedLabel = DemoTextItem("PAUSED", Colors.buttonFont(), QtCore.Qt.white, -1, self.scene, None) self.pausedLabel.setZValue(100) fm = QtGui.QFontMetricsF(Colors.buttonFont()) self.pausedLabel.setPos(Colors.stageWidth - fm.width("PAUSED"), 590 - fm.height()) self.pausedLabel.setRecursiveVisible(False)
def setupHoverText(self): if not self.buttonLabel: return textItem = DemoTextItem(self.buttonLabel, Colors.buttonFont(), Colors.buttonText, -1, self) textItem.setZValue(self.zValue() + 2) textItem.setPos(16, 0)
def createContent(self): # Create the items. self.heading = HeadingItem(self.name, self.scene(), self) self.description = DemoTextItem(self.loadDescription(), Colors.contentFont(), Colors.heading, 500, self.scene(), self) imgHeight = 340 - int(self.description.boundingRect().height()) + 50 self.screenshot = ImageItem(QtGui.QImage.fromData(self._menu_manager.getImage(self.name)), 550, imgHeight, self.scene(), self) # Place the items on screen. self.heading.setPos(0, 3) self.description.setPos(0, self.heading.pos().y() + self.heading.boundingRect().height() + 10) self.screenshot.setPos(0, self.description.pos().y() + self.description.boundingRect().height() + 10)