本文整理汇总了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