提交 5085cead 编写于 作者: K Kentaro Wada

Add dot with color in polygon list

上级 739042f7
# -*- coding: utf-8 -*-
import functools
import os
import os.path as osp
......@@ -963,11 +965,16 @@ class MainWindow(QtWidgets.QMainWindow):
text = shape.label
else:
text = '{} ({})'.format(shape.label, shape.group_id)
item = QtWidgets.QListWidgetItem(text)
item = QtWidgets.QListWidgetItem()
item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
item.setCheckState(Qt.Checked)
self.labelList.itemsToShapes.append((item, shape))
self.labelList.addItem(item)
qlabel = QtWidgets.QLabel()
qlabel.setText(text)
qlabel.setAlignment(QtCore.Qt.AlignBottom)
item.setSizeHint(qlabel.sizeHint())
self.labelList.setItemWidget(item, qlabel)
if not self.uniqLabelList.findItems(shape.label, Qt.MatchExactly):
self.uniqLabelList.addItem(shape.label)
self.labelDialog.addLabelHistory(shape.label)
......@@ -984,6 +991,10 @@ class MainWindow(QtWidgets.QMainWindow):
r, g, b = self._config['default_shape_color']
else:
return
qlabel.setText(
'{} <font color="#{:02x}{:02x}{:02x}">●</font>'
.format(text, r, g, b)
)
shape.line_color = QtGui.QColor(r, g, b)
shape.vertex_fill_color = QtGui.QColor(r, g, b)
shape.hvertex_fill_color = QtGui.QColor(255, 255, 255)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册