本文整理匯總了Python中PySide.QtGui.QFont.defaultFamily方法的典型用法代碼示例。如果您正苦於以下問題:Python QFont.defaultFamily方法的具體用法?Python QFont.defaultFamily怎麽用?Python QFont.defaultFamily使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide.QtGui.QFont
的用法示例。
在下文中一共展示了QFont.defaultFamily方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_facets_font
# 需要導入模塊: from PySide.QtGui import QFont [as 別名]
# 或者: from PySide.QtGui.QFont import defaultFamily [as 別名]
def create_facets_font ( value ):
""" Creates a FacetFont object from a string description.
"""
global font_cache
if isinstance( value, QFont ):
return FacetsFont( value )
# Replace any list of fonts by a single matching font:
value = font_select( value )
# Check to see if the font is already in the cache, and return it if it is:
font = font_cache.get( value )
if font is not None:
return font
point_size = None
family = ''
style = QFont.StyleNormal
weight = QFont.Normal
underline = False
facename = []
for word in value.split():
lword = word.lower()
if font_families.has_key( lword ):
f = QFont()
f.setStyleHint( font_families[ lword ] )
family = f.defaultFamily()
elif font_styles.has_key( lword ):
style = font_styles[ lword ]
elif font_weights.has_key( lword ):
weight = font_weights[ lword ]
elif lword == 'underline':
underline = True
elif lword not in font_noise:
if point_size is None:
try:
point_size = int( lword )
continue
except:
pass
facename.append( word )
if facename:
family = ' '.join( facename )
if family:
font = FacetsFont( family )
else:
font = FacetsFont()
font.setStyle( style )
font.setWeight( weight )
font.setUnderline( underline )
if point_size is not None:
font.setPointSize( point_size )
font_cache[ value ] = font
return font