本文整理匯總了Python中PyQt5.QtGui.QFontDatabase.styles方法的典型用法代碼示例。如果您正苦於以下問題:Python QFontDatabase.styles方法的具體用法?Python QFontDatabase.styles怎麽用?Python QFontDatabase.styles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtGui.QFontDatabase
的用法示例。
在下文中一共展示了QFontDatabase.styles方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: findStyles
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import styles [as 別名]
def findStyles(self, font):
fontDatabase = QFontDatabase()
currentItem = self.styleCombo.currentText()
self.styleCombo.clear()
for style in fontDatabase.styles(font.family()):
self.styleCombo.addItem(style)
styleIndex = self.styleCombo.findText(currentItem)
if styleIndex == -1:
self.styleCombo.setCurrentIndex(0)
else:
self.styleCombo.setCurrentIndex(styleIndex)
示例2: __init__
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import styles [as 別名]
def __init__(self):
super(MainWindow, self).__init__()
font_id = QFontDatabase.addApplicationFont("fontawesome-webfont.ttf")
if font_id is not -1:
font_db = QFontDatabase()
self.font_styles = font_db.styles('FontAwesome')
self.font_families = QFontDatabase.applicationFontFamilies(font_id)
print(self.font_styles, self.font_families)
for font_family in self.font_families:
self.font = font_db.font(font_family, self.font_styles[0], 18)
self.home()