@@ -112,15 +112,17 @@ def drawPicture(self, p, axisSpec, tickSpecs, textSpecs) -> None:
112112 if self .style ['tickFont' ] is not None :
113113 p .setFont (self .style ['tickFont' ])
114114 p .setPen (self .textPen ())
115- min_height = p . fontMetrics (). height ()
115+ min_height = self . textHeight + 1
116116 bounding = self .boundingRect ().toAlignedRect ()
117117 p .setClipRect (bounding )
118118 if self .tick_angle == 0 :
119119 for rect , flags , text in textSpecs :
120+ if min_height <= rect .height ():
121+ min_height = rect .height ()
120122 p .drawText (rect , int (flags ), text )
121123 if self .label .isVisible ():
122- min_height += self .label .boundingRect ().height () * 0.8
123- self .fixedHeight = min_height + 7
124+ min_height += self .label .boundingRect ().height ()
125+ self .fixedHeight = min_height
124126 else :
125127 if self .orientation in ("bottom" , "top" ):
126128 max_height = min_height
@@ -151,13 +153,10 @@ def drawPicture(self, p, axisSpec, tickSpecs, textSpecs) -> None:
151153 scene_rect = p .transform ().mapRect (rect )
152154 if scene_rect .height () > max_height :
153155 max_height = scene_rect .height ()
154- if scene_rect .width () > max_height :
155- max_height = scene_rect .width ()
156156 p .drawText (rect , int (flags ), text )
157157 # restoring the painter is *required*!!!
158158 p .restore ()
159-
160- self .fixedHeight = offset_top + max_height + 10
159+ self .fixedHeight = offset_top + max_height + 5
161160 else :
162161 for rect , flags , text in textSpecs :
163162 p .save ()
0 commit comments