- fixed the bug where the HUD did not used the set font size from Preferences
This commit is contained in:
committed by
Marius Stanciu
parent
d90e86da39
commit
23822ea774
@@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
31.08.2021
|
31.08.2021
|
||||||
|
|
||||||
- made sure that the location labels in the InfoBar have only the decimals required when the Grid snapping is ON
|
- made sure that the location labels in the InfoBar have only the decimals required when the Grid snapping is ON
|
||||||
|
- fixed the bug where the HUD did not used the set font size from Preferences
|
||||||
|
|
||||||
30.08.2021
|
30.08.2021
|
||||||
|
|
||||||
|
|||||||
@@ -334,11 +334,16 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
|||||||
fsize = 8
|
fsize = 8
|
||||||
|
|
||||||
c_font = QtGui.QFont()
|
c_font = QtGui.QFont()
|
||||||
|
c_font.setPointSize(fsize)
|
||||||
c_font_metrics = QtGui.QFontMetrics(c_font)
|
c_font_metrics = QtGui.QFontMetrics(c_font)
|
||||||
l1_length = c_font_metrics.horizontalAdvance(l1_hud_text, len(l1_hud_text))
|
# l1_length = c_font_metrics.horizontalAdvance(l1_hud_text)
|
||||||
l2_length = c_font_metrics.horizontalAdvance(l2_hud_text, len(l2_hud_text))
|
# l2_length = c_font_metrics.horizontalAdvance(l2_hud_text)
|
||||||
l3_length = c_font_metrics.horizontalAdvance(l3_hud_text, len(l3_hud_text))
|
# l3_length = c_font_metrics.horizontalAdvance(l3_hud_text)
|
||||||
l4_length = c_font_metrics.horizontalAdvance(l4_hud_text, len(l4_hud_text))
|
# l4_length = c_font_metrics.horizontalAdvance(l4_hud_text)
|
||||||
|
l1_length = c_font_metrics.boundingRect(l1_hud_text).width()
|
||||||
|
l2_length = c_font_metrics.boundingRect(l2_hud_text).width()
|
||||||
|
l3_length = c_font_metrics.boundingRect(l3_hud_text).width()
|
||||||
|
l4_length = c_font_metrics.boundingRect(l4_hud_text).width()
|
||||||
|
|
||||||
l1_height = c_font_metrics.boundingRect(l1_hud_text).height()
|
l1_height = c_font_metrics.boundingRect(l1_hud_text).height()
|
||||||
l2_height = c_font_metrics.boundingRect(l2_hud_text).height()
|
l2_height = c_font_metrics.boundingRect(l2_hud_text).height()
|
||||||
@@ -347,9 +352,9 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
|||||||
|
|
||||||
# coordinates and anchors
|
# coordinates and anchors
|
||||||
# height = fsize * 11 # 90. Constant 11 is something that works
|
# height = fsize * 11 # 90. Constant 11 is something that works
|
||||||
height = l1_height + l2_height + l3_height + l4_height + (2 * c_font_metrics.lineSpacing())
|
height = l1_height + l2_height + l3_height + l4_height + (0. * c_font_metrics.lineSpacing()) + 10
|
||||||
# width = height * 2 # width is double the height = it is something that works
|
# width = height * 2 # width is double the height = it is something that works
|
||||||
width = max(l1_length, l2_length, l3_length, l4_length)
|
width = max(l1_length, l2_length, l3_length, l4_length) * 1.27 # don't know where the 1.27 comes
|
||||||
center_x = (width / 2) + 5
|
center_x = (width / 2) + 5
|
||||||
center_y = (height / 2) + 5
|
center_y = (height / 2) + 5
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user