當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。