initial fluent-widgets ui
This commit is contained in:
38
qfluentwidgets/common/font.py
Normal file
38
qfluentwidgets/common/font.py
Normal file
@ -0,0 +1,38 @@
|
||||
# coding: utf-8
|
||||
from PySide6.QtGui import QFont
|
||||
from PySide6.QtWidgets import QWidget
|
||||
|
||||
|
||||
def setFont(widget: QWidget, fontSize=14, weight=QFont.Normal):
|
||||
""" set the font of widget
|
||||
|
||||
Parameters
|
||||
----------
|
||||
widget: QWidget
|
||||
the widget to set font
|
||||
|
||||
fontSize: int
|
||||
font pixel size
|
||||
|
||||
weight: `QFont.Weight`
|
||||
font weight
|
||||
"""
|
||||
widget.setFont(getFont(fontSize, weight))
|
||||
|
||||
|
||||
def getFont(fontSize=14, weight=QFont.Normal):
|
||||
""" create font
|
||||
|
||||
Parameters
|
||||
----------
|
||||
fontSize: int
|
||||
font pixel size
|
||||
|
||||
weight: `QFont.Weight`
|
||||
font weight
|
||||
"""
|
||||
font = QFont()
|
||||
font.setFamilies(['Segoe UI', 'Microsoft YaHei', 'PingFang SC'])
|
||||
font.setPixelSize(fontSize)
|
||||
font.setWeight(weight)
|
||||
return font
|
||||
Reference in New Issue
Block a user