当前位置: 首页>>代码示例>>Python>>正文


Python QFontDatabase.font方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QFontDatabase.font方法的典型用法代码示例。如果您正苦于以下问题:Python QFontDatabase.font方法的具体用法?Python QFontDatabase.font怎么用?Python QFontDatabase.font使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui.QFontDatabase的用法示例。


在下文中一共展示了QFontDatabase.font方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: updateStyle

# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import font [as 别名]
 def updateStyle(self, fontStyle):
     fontDatabase = QFontDatabase()
     oldStrategy = self.displayFont.styleStrategy()
     self.displayFont = fontDatabase.font(self.displayFont.family(),
             fontStyle, self.displayFont.pointSize())
     self.displayFont.setStyleStrategy(oldStrategy)
     self.squareSize = max(24, QFontMetrics(self.displayFont).xHeight() * 3)
     self.adjustSize()
     self.update()
开发者ID:death-finger,项目名称:Scripts,代码行数:11,代码来源:charactermap.py

示例2: __init__

# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import font [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()
开发者ID:sdouglas,项目名称:lr-notebook,代码行数:15,代码来源:qtfa.py

示例3: QFontDatabase

# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import font [as 别名]
myfdb = QFontDatabase()
genqf = myfdb.systemFont(QFontDatabase.GeneralFont)
fonts.initialize(settings)
assert same_font(genqf,fonts.get_general())
monqf = fonts.get_fixed()
dbg = monqf.family()
assert monqf.family() == 'Liberation Mono'
assert monqf.pointSize() == C.DEFAULT_FONT_SIZE
SIGBOOL = None
def slot(boola):
    global SIGBOOL
    SIGBOOL = boola
fonts.notify_me(slot)
fonts.set_general(genqf) # should be no signal
assert SIGBOOL is None
palqf = myfdb.font('Palatino','Normal',18)
fonts.set_general(palqf) # should cause signal(false)
assert SIGBOOL == False # altho None is never true, it isn't False
couqf = myfdb.font('Courier','Normal',17)
fonts.set_fixed(couqf) # should cause signal(true)
assert SIGBOOL
# check shutdown
fonts.shutdown(settings)
assert settings.value('fonts/general_family') == palqf.family()
assert settings.value('fonts/mono_family') == couqf.family()
assert settings.value('fonts/general_size') == palqf.pointSize()
assert settings.value('fonts/mono_size') == couqf.pointSize()
# check scale
ps = genqf.pointSize()
genqf = fonts.scale(C.CTL_SHFT_EQUAL, genqf)
assert (ps+1) == genqf.pointSize()
开发者ID:B-Rich,项目名称:PPQT2,代码行数:33,代码来源:fonts_test.py


注:本文中的PyQt5.QtGui.QFontDatabase.font方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。