本文整理汇总了Python中PySide.QtGui.QFont.setWeight方法的典型用法代码示例。如果您正苦于以下问题:Python QFont.setWeight方法的具体用法?Python QFont.setWeight怎么用?Python QFont.setWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QFont
的用法示例。
在下文中一共展示了QFont.setWeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setWeight [as 别名]
def __init__(self, view, uistack, widget):
f = QFont('FreeMono')
f.setWeight(QFont.Black)
f.setPixelSize(16)
self.grids = []
self.colors = []
self._view = view
for p in providers:
view.colors.addItem(p.name)
view.colors.currentIndexChanged.connect(self.colorchange)
self._detailview = view.detail
self._detailview.scale(10, 10)
self._lastdepth = -1
self._detail = None
self.add()
view.layer.sliderMoved.connect(self.layer)
view.detailLayer.sliderMoved.connect(self.detaillayer)
self._view.add.pressed.connect(self.add)
def detailevent(event):
if (isinstance(event, QKeyEvent) and
event.text() == u'\t' and
event.type() == QEvent.ShortcutOverride):
widget.keyPressEvent(QKeyEvent(
QEvent.KeyPress,
event.key(),
event.nativeModifiers(),
event.text(),
event.isAutoRepeat(),
event.count()))
return True
return QWidget.event(widget, event)
widget.event = detailevent
widget.keyPressEvent = self.key
view.rotation.valueChanged.connect(self.rotate)
view.layer.setValue(view.layer.maximum())
self._view.showDetail.pressed.connect(self.showdetail)
self._view.hideDetail.pressed.connect(self.hidedetail)
self.hidedetail()
self._view.pentagon.pressed.connect(self.pentagon)
self._uistack = uistack
示例2: load_layout_list
# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setWeight [as 别名]
def load_layout_list(self, settings):
self.layout_list.clear()
for menu_item in settings:
font = QFont()
if menu_item == 'pin_notes' or menu_item == 'notes':
font.setStyle(QFont.StyleItalic)
else:
font.setWeight(QFont.DemiBold)
item = QListWidgetItem(self.layout_labels[menu_item])
item.setData(Qt.UserRole, menu_item)
item.setTextAlignment(Qt.AlignCenter)
item.setFont(font)
self.layout_list.addItem(item)
示例3: PlainText
# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setWeight [as 别名]
def PlainText(painter,widget):
painter.setPen(widget.textColor())
font = QFont()
font.setPixelSize(widget.fontSize())
font.setOverline(widget.overline())
font.setUnderline(widget.underlined())
font.setItalic(widget.italic())
font.setStrikeOut(widget.strikeOut())
font.setWeight(widget.fontWeight())
font.setFamily(widget.fontFamily())
font.setCapitalization( QFont.Capitalization(widget.textTransform()) )
font.setStretch(widget.fontStretch())
font.setLetterSpacing(QFont.SpacingType(widget.letterSpacingType()), widget.letterSpacing())
font.setWordSpacing(widget.wordSpacing())
painter.setFont(font)
painter.drawText(0,0,100,100,widget.textAlignment(),widget.text())
示例4: initUI
# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setWeight [as 别名]
def initUI(self):
"""Met en place les éléments de l'interface."""
# -+++++++------------------- main window -------------------+++++++- #
self.setWindowTitle(u"Encodage / Décodage de Huffman")
self.centerAndResize()
centralwidget = QWidget(self)
mainGrid = QGridLayout(centralwidget)
mainGrid.setColumnMinimumWidth(0, 450)
# -+++++++------------------ groupe analyse -----------------+++++++- #
analysGroup = QGroupBox(u"Analyse", centralwidget)
self.analysGrid = QGridLayout(analysGroup)
# ----------- groupe de la table des codes ---------- #
codeTableGroup = QGroupBox(u"Table des codes", analysGroup)
codeTableGrid = QGridLayout(codeTableGroup)
# un tableau pour les codes
self.codesTableModel = MyTableModel()
self.codesTable = QTableView(codeTableGroup)
self.codesTable.setModel(self.codesTableModel)
self.codesTable.setFont(QFont("Mono", 8))
self.codesTable.resizeColumnsToContents()
self.codesTable.setSortingEnabled(True)
codeTableGrid.addWidget(self.codesTable, 0, 0, 1, 1)
self.analysGrid.addWidget(codeTableGroup, 1, 0, 1, 1)
# ----------- label du ratio de compression ---------- #
self.ratioLab = QLabel(u"Ratio de compression: ", analysGroup)
font = QFont()
font.setBold(True)
font.setWeight(75)
font.setKerning(True)
self.ratioLab.setFont(font)
self.analysGrid.addWidget(self.ratioLab, 2, 0, 1, 1)
# -+++++++-------- groupe de la table de comparaison --------+++++++- #
self.compGroup = QGroupBox(analysGroup)
self.compGroup.setTitle(u"Comparaisons")
compGrid = QGridLayout(self.compGroup)
# un tableau pour le ratio
self.compTable = QTableWidget(self.compGroup)
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.compTable.sizePolicy().hasHeightForWidth())
self.compTable.setSizePolicy(sizePolicy)
self.compTable.setBaseSize(QSize(0, 0))
font = QFont()
font.setWeight(50)
self.compTable.setFont(font)
self.compTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.compTable.setShowGrid(True)
self.compTable.setGridStyle(Qt.SolidLine)
# lignes / colonnes
self.compTable.setColumnCount(2)
self.compTable.setRowCount(3)
self.compTable.setVerticalHeaderItem(0, QTableWidgetItem("Taille (bits)"))
self.compTable.setVerticalHeaderItem(1, QTableWidgetItem("Entropie"))
self.compTable.setVerticalHeaderItem(2, QTableWidgetItem("Taille moy. (bits)"))
for i in range(2):
self.compTable.verticalHeaderItem(i).setTextAlignment(
Qt.AlignRight)
self.compTable.setHorizontalHeaderItem(0, QTableWidgetItem("ASCII"))
self.compTable.setHorizontalHeaderItem(1, QTableWidgetItem("Huffman"))
# nom des items
self.compTabASCIIMem = QTableWidgetItem()
self.compTable.setItem(0, 0, self.compTabASCIIMem)
self.compTabASCIIEnt = QTableWidgetItem()
self.compTable.setItem(1, 0, self.compTabASCIIEnt)
self.compTabASCIIAvg = QTableWidgetItem()
self.compTable.setItem(2, 0, self.compTabASCIIAvg)
self.compTabHuffMem = QTableWidgetItem()
self.compTable.setItem(0, 1, self.compTabHuffMem)
self.compTabHuffEnt = QTableWidgetItem()
self.compTable.setItem(1, 1, self.compTabHuffEnt)
self.compTabHuffAvg = QTableWidgetItem()
self.compTable.setItem(2, 1, self.compTabHuffAvg)
# parem du tableau
self.compTable.horizontalHeader().setCascadingSectionResizes(False)
self.compTable.verticalHeader().setVisible(True)
font = QFont("Mono", 8)
self.compTable.setFont(font)
compGrid.addWidget(self.compTable, 1, 0, 1, 1)
self.analysGrid.addWidget(self.compGroup, 0, 0, 1, 1)
mainGrid.addWidget(analysGroup, 0, 1, 1, 1)
# -+++++++----------------- groupe du texte -----------------+++++++- #
groupBox = QGroupBox(u"Texte", centralwidget)
textGrid = QGridLayout(groupBox)
# -+++++++------------- groupe du texte original ------------+++++++- #
orgTextGroup = QGroupBox(u"Texte original (Ctrl+T)", groupBox)
orgTextGrid = QGridLayout(orgTextGroup)
self.orgText = QTextEdit(orgTextGroup)
self.orgText.setPalette(self.defaultPalette)
orgTextGrid.addWidget(self.orgText, 0, 0, 1, 1)
textGrid.addWidget(orgTextGroup, 0, 0, 1, 2)
# -+++++++------------ groupe du texte compressé ------------+++++++- #
compressedTextGroup = QGroupBox(u"Texte compressé (Ctrl+H)", groupBox)
compressedTextGrid = QGridLayout(compressedTextGroup)
self.compressedText = QTextEdit(compressedTextGroup)
self.compressedText.setPalette(self.defaultPalette)
compressedTextGrid.addWidget(self.compressedText, 0, 0, 1, 1)
textGrid.addWidget(compressedTextGroup, 1, 0, 1, 2)
#.........这里部分代码省略.........