Fix draw annotations error (#833)

This commit is contained in:
Sam.An 2021-12-28 12:05:21 +09:00 committed by GitHub
parent b1e13347dd
commit 5c38b6bcdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -962,7 +962,7 @@ class MainWindow(QMainWindow, WindowMixin):
def scroll_request(self, delta, orientation): def scroll_request(self, delta, orientation):
units = - delta / (8 * 15) units = - delta / (8 * 15)
bar = self.scroll_bars[orientation] bar = self.scroll_bars[orientation]
bar.setValue(bar.value() + bar.singleStep() * units) bar.setValue(int(bar.value() + bar.singleStep() * units))
def set_zoom(self, value): def set_zoom(self, value):
self.actions.fitWidth.setChecked(False) self.actions.fitWidth.setChecked(False)

View File

@ -525,12 +525,12 @@ class Canvas(QWidget):
p.setPen(self.drawing_rect_color) p.setPen(self.drawing_rect_color)
brush = QBrush(Qt.BDiagPattern) brush = QBrush(Qt.BDiagPattern)
p.setBrush(brush) p.setBrush(brush)
p.drawRect(left_top.x(), left_top.y(), rect_width, rect_height) p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height))
if self.drawing() and not self.prev_point.isNull() and not self.out_of_pixmap(self.prev_point): if self.drawing() and not self.prev_point.isNull() and not self.out_of_pixmap(self.prev_point):
p.setPen(QColor(0, 0, 0)) p.setPen(QColor(0, 0, 0))
p.drawLine(self.prev_point.x(), 0, self.prev_point.x(), self.pixmap.height()) p.drawLine(int(self.prev_point.x()), 0, int(self.prev_point.x()), int(self.pixmap.height()))
p.drawLine(0, self.prev_point.y(), self.pixmap.width(), self.prev_point.y()) p.drawLine(0, int(self.prev_point.y()), int(self.pixmap.width()), int(self.prev_point.y()))
self.setAutoFillBackground(True) self.setAutoFillBackground(True)
if self.verified: if self.verified:

View File

@ -128,7 +128,7 @@ class Shape(object):
self.label = "" self.label = ""
if min_y < min_y_label: if min_y < min_y_label:
min_y += min_y_label min_y += min_y_label
painter.drawText(min_x, min_y, self.label) painter.drawText(int(min_x), int(min_y), self.label)
if self.fill: if self.fill:
color = self.select_fill_color if self.selected else self.fill_color color = self.select_fill_color if self.selected else self.fill_color