Skip to content

Commit

Permalink
Merge pull request #3803 from VesnaT/VerticalItemDelegate
Browse files Browse the repository at this point in the history
[FIX] VerticalItemDelegate: Do not cut long vertical labels
  • Loading branch information
janezd authored May 27, 2019
2 parents c01e7a7 + 102a2c5 commit 4245960
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Orange/widgets/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3084,6 +3084,10 @@ class VerticalItemDelegate(QStyledItemDelegate):
# Extra text top/bottom margin.
Margin = 6

def __init__(self, extend=False):
super().__init__()
self._extend = extend # extend text over cell borders

def sizeHint(self, option, index):
sh = super().sizeHint(option, index)
return QtCore.QSize(sh.height() + self.Margin * 2, sh.width())
Expand Down Expand Up @@ -3121,6 +3125,8 @@ def paint(self, painter, option, index):
offset = -offset

textrect.translate(0, offset)
if self._extend and brect.width() > itemrect.width():
textrect.setWidth(brect.width())

painter.translate(option.rect.x(), option.rect.bottom())
painter.rotate(-90)
Expand Down

0 comments on commit 4245960

Please sign in to comment.