Skip to content

Commit

Permalink
Ensure integer arguments for qt paint functions
Browse files Browse the repository at this point in the history
otherwise these might segfault
  • Loading branch information
k-dominik committed May 6, 2024
1 parent 126b3e1 commit afe12e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ilastik/widgets/featureTableWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ def drawPixmapForChecked(self, painter: QPainter, width: int, height: int) -> No
painter.drawRect(QRect(5, 5, width - 10, height - 10))
pen.setWidth(4)
painter.setPen(pen)
painter.drawLine(width / 2 - 5, height / 2, width / 2, height - 10)
painter.drawLine(width / 2, height - 10, width / 2 + 10, 2)
painter.drawLine(width // 2 - 5, height // 2, width // 2, height - 10)
painter.drawLine(width // 2, height - 10, width // 2 + 10, 2)
painter.end()

def drawPixmapForPartiallyChecked(self, painter: QPainter, width: int, height: int) -> None:
Expand All @@ -310,8 +310,8 @@ def drawPixmapForPartiallyChecked(self, painter: QPainter, width: int, height: i
pen.setWidth(4)
pen.setColor(QColor(139, 137, 137))
painter.setPen(pen)
painter.drawLine(width / 2 - 5, height / 2, width / 2, height - 10)
painter.drawLine(width / 2, height - 10, width / 2 + 10, 2)
painter.drawLine(width // 2 - 5, height // 2, width // 2, height - 10)
painter.drawLine(width // 2, height - 10, width // 2 + 10, 2)

Check warning on line 314 in ilastik/widgets/featureTableWidget.py

View check run for this annotation

Codecov / codecov/patch

ilastik/widgets/featureTableWidget.py#L313-L314

Added lines #L313 - L314 were not covered by tests
painter.end()

def paint(self, painter, option, index):
Expand Down

0 comments on commit afe12e6

Please sign in to comment.