未验证 提交 76012cc4 编写于 作者: E Evezerest 提交者: GitHub

Merge pull request #6951 from whjdark/dygraph

修正高分辨率图像下BBOX标签和排序数字字体过小的问题
...@@ -624,6 +624,13 @@ class Canvas(QWidget): ...@@ -624,6 +624,13 @@ class Canvas(QWidget):
pal.setColor(self.backgroundRole(), QColor(232, 232, 232, 255)) pal.setColor(self.backgroundRole(), QColor(232, 232, 232, 255))
self.setPalette(pal) self.setPalette(pal)
# adaptive BBOX label & index font size
if self.pixmap:
h, w = self.pixmap.size().height(), self.pixmap.size().width()
fontszie = int(max(h, w) / 48)
for s in self.shapes:
s.fontsize = fontszie
p.end() p.end()
def fillDrawing(self): def fillDrawing(self):
......
...@@ -66,6 +66,7 @@ class Shape(object): ...@@ -66,6 +66,7 @@ class Shape(object):
self.NEAR_VERTEX: (4, self.P_ROUND), self.NEAR_VERTEX: (4, self.P_ROUND),
self.MOVE_VERTEX: (1.5, self.P_SQUARE), self.MOVE_VERTEX: (1.5, self.P_SQUARE),
} }
self.fontsize = 8
self._closed = False self._closed = False
...@@ -156,7 +157,7 @@ class Shape(object): ...@@ -156,7 +157,7 @@ class Shape(object):
min_y = min(min_y, point.y()) min_y = min(min_y, point.y())
if min_x != sys.maxsize and min_y != sys.maxsize: if min_x != sys.maxsize and min_y != sys.maxsize:
font = QFont() font = QFont()
font.setPointSize(8) font.setPointSize(self.fontsize)
font.setBold(True) font.setBold(True)
painter.setFont(font) painter.setFont(font)
if self.label is None: if self.label is None:
...@@ -174,7 +175,7 @@ class Shape(object): ...@@ -174,7 +175,7 @@ class Shape(object):
min_y = min(min_y, point.y()) min_y = min(min_y, point.y())
if min_x != sys.maxsize and min_y != sys.maxsize: if min_x != sys.maxsize and min_y != sys.maxsize:
font = QFont() font = QFont()
font.setPointSize(8) font.setPointSize(self.fontsize)
font.setBold(True) font.setBold(True)
painter.setFont(font) painter.setFont(font)
text = '' text = ''
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册