Use integer division to set font weight

QFont::setFontWeight takes an int only - it looks like PyQt accepts a float and
just truncates it. That's the behaviour we actually want here, but let's be
explicit about it.
This commit is contained in:
Florian Bruhin 2018-11-26 23:25:13 +01:00
parent d2751935e0
commit 462e07a578

View File

@ -1119,7 +1119,7 @@ class QtFont(Font):
font.setWeight(weight_map[namedweight])
if weight:
# based on qcssparser.cpp:setFontWeightFromValue
font.setWeight(min(int(weight) / 8, 99))
font.setWeight(min(int(weight) // 8, 99))
if size:
if size.lower().endswith('pt'):
font.setPointSizeF(float(size[:-2]))