Skip to content

Commit c559bd2

Browse files
committed
Fix critical failure in QwtLegendLabel sizeHint
1 parent d7447b7 commit c559bd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

qwt/legend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ def sizeHint(self):
390390
:return: a size hint
391391
"""
392392
sz = QwtTextLabel.sizeHint(self)
393-
sz.setHeight(max([sz.height(), self.__data.icon.height() + 4]))
393+
icon_height = 0 if self.__data.icon is None else self.__data.icon.height()
394+
sz.setHeight(max([sz.height(), icon_height + 4]))
394395
if self.__data.itemMode != QwtLegendData.ReadOnly:
395396
sz += buttonShift(self)
396397
return sz

0 commit comments

Comments
 (0)