本文整理匯總了Python中PyQt4.QtGui.QFontComboBox.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Python QFontComboBox.setFont方法的具體用法?Python QFontComboBox.setFont怎麽用?Python QFontComboBox.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui.QFontComboBox
的用法示例。
在下文中一共展示了QFontComboBox.setFont方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: PropertyBar
# 需要導入模塊: from PyQt4.QtGui import QFontComboBox [as 別名]
# 或者: from PyQt4.QtGui.QFontComboBox import setFont [as 別名]
class PropertyBar(QGroupBox):
def __init__(self,parent):
QGroupBox.__init__(self,parent)
self.parent = parent
self.setMaximumHeight(130)
self.layout = QHBoxLayout(self)
self.layout.setMargin(10)
self.setTitle("Property")
lab1 = QLabel("Text: ")
lab2 = QLabel("Font: ")
lab3 = QLabel("Size: ")
self.lab4 = QLabel("x: ")
self.lab5 = QLabel("y: ")
self.lab6 = QLabel(": ")
self.led1 = QLineEdit()
self.led2 = QFontComboBox()
self.led3 = QComboBox()
for i in range(1,50):
self.led3.addItem(str(i))
self.layout.addWidget(lab1)
self.layout.addWidget(self.led1)
self.layout.addWidget(lab2)
self.layout.addWidget(self.led2)
self.layout.addWidget(lab3)
self.layout.addWidget(self.led3)
self.layout.addWidget(self.lab4)
self.layout.addWidget(self.lab5)
self.layout.addWidget(self.lab6)
def initText(self,item):
text = item.toPlainText()
font = item.font()
size = item.font().pointSize()
pos = item.pos().toPoint()
z = item.zValue()
self.led1.setText(text)
self.led2.setFont(font)
self.led3.setCurrentIndex(size)
self.lab4.setText("x: "+str(pos.x()))
self.lab5.setText("y: "+str(pos.y()))
self.lab6.setText("z: "+str(z))
def setPos(self,pos):
self.lab4.setText("x: "+str(pos.x()))
self.lab5.setText("y: "+str(pos.y()))
def connectText(self,item):
self.led1.textChanged.connect(item.setText)
self.led2.currentFontChanged.connect(item.setFont)
self.led3.currentIndexChanged.connect(item.setSize)
self.connect(item, SIGNAL("move"), self.setPos)
def disconnectText(self,item):
self.led1.textChanged.disconnect(item.setText)
self.led2.currentFontChanged.disconnect(item.setFont)
self.led3.currentIndexChanged.disconnect(item.setSize)
self.disconnect(item, SIGNAL("move"), self.setPos)