@@ -112,15 +112,17 @@ def drawPicture(self, p, axisSpec, tickSpecs, textSpecs) -> None:
112
112
if self .style ['tickFont' ] is not None :
113
113
p .setFont (self .style ['tickFont' ])
114
114
p .setPen (self .textPen ())
115
- min_height = p . fontMetrics (). height ()
115
+ min_height = self . textHeight + 1
116
116
bounding = self .boundingRect ().toAlignedRect ()
117
117
p .setClipRect (bounding )
118
118
if self .tick_angle == 0 :
119
119
for rect , flags , text in textSpecs :
120
+ if min_height <= rect .height ():
121
+ min_height = rect .height ()
120
122
p .drawText (rect , int (flags ), text )
121
123
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
124
126
else :
125
127
if self .orientation in ("bottom" , "top" ):
126
128
max_height = min_height
@@ -151,13 +153,10 @@ def drawPicture(self, p, axisSpec, tickSpecs, textSpecs) -> None:
151
153
scene_rect = p .transform ().mapRect (rect )
152
154
if scene_rect .height () > max_height :
153
155
max_height = scene_rect .height ()
154
- if scene_rect .width () > max_height :
155
- max_height = scene_rect .width ()
156
156
p .drawText (rect , int (flags ), text )
157
157
# restoring the painter is *required*!!!
158
158
p .restore ()
159
-
160
- self .fixedHeight = offset_top + max_height + 10
159
+ self .fixedHeight = offset_top + max_height + 5
161
160
else :
162
161
for rect , flags , text in textSpecs :
163
162
p .save ()
0 commit comments