GlyphDBEdit: display glyph texts with proper font, according to glyph_font_family and glyph_font_size config variables.
This commit is contained in:
parent
45ef8dc691
commit
458ef0e6f4
2 changed files with 8 additions and 0 deletions
|
|
@ -19,6 +19,8 @@ from confire import Configuration as BaseConfiguration
|
|||
|
||||
class Configuration(BaseConfiguration):
|
||||
allow_bold_italic = True
|
||||
glyph_font_family = None
|
||||
glyph_font_size = None
|
||||
|
||||
min_body_height = 10
|
||||
min_word_distance = 15
|
||||
|
|
|
|||
|
|
@ -58,12 +58,18 @@ class Column(object):
|
|||
|
||||
class TextColumn(Column):
|
||||
def data(self, glyph_data, role):
|
||||
config = self.document.config
|
||||
|
||||
if role == Qt.DecorationRole:
|
||||
return glyph_data.image.qimage
|
||||
elif role == Qt.FontRole:
|
||||
font = QFont()
|
||||
font.setBold(glyph_data.bold)
|
||||
font.setItalic(glyph_data.italic)
|
||||
if config.glyph_font_family:
|
||||
font.setFamily(config.glyph_font_family)
|
||||
if config.glyph_font_size:
|
||||
font.setPixelSize(config.glyph_font_size)
|
||||
return font
|
||||
else:
|
||||
return super().data(glyph_data, role)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue