개정판 b9091c43
issue #655: show char in training editor dialog
DTI_PID/DTI_PID/Shapes/TrainingBoxItem.py | ||
---|---|---|
38 | 38 |
self.spinBoxFlag = None |
39 | 39 |
|
40 | 40 |
self.transfer = Transfer() |
41 |
#sung |
|
42 |
self.textShowBox = None |
|
41 | 43 |
|
42 | 44 |
def mousePressEvent(self, event): |
43 | 45 |
self.spinBoxFlag = True |
... | ... | |
82 | 84 |
pen.setWidthF(1) |
83 | 85 |
pen.setJoinStyle(Qt.MiterJoin) |
84 | 86 |
self.setPen(pen) |
85 |
|
|
86 | 87 |
self.scene.addItem(self) |
87 | 88 |
|
89 |
self.textShowBox = QGraphicsTextItem(self.char) |
|
90 |
self.textShowBox.setDefaultTextColor(Qt.green) |
|
91 |
self.textShowBox.setPos(self.rect().x() + round(self.rect().width() / 2), self.rect().y() - round(self.rect().height() / 2)) |
|
92 |
|
|
93 |
self.scene.addItem(self.textShowBox) |
|
88 | 94 |
|
89 | 95 |
except Exception as ex: |
90 | 96 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
DTI_PID/DTI_PID/TrainingEditorDialog.py | ||
---|---|---|
191 | 191 |
if len(items) is not 1: |
192 | 192 |
return |
193 | 193 |
items[0].char = self.ui.lineEditChar.text() |
194 |
items[0].textShowBox.setHtml(self.ui.lineEditChar.text()) |
|
194 | 195 |
|
195 | 196 |
''' |
196 | 197 |
@brief close dialog by button click |
... | ... | |
248 | 249 |
if spinBoxName == 'spinBoxLeft': |
249 | 250 |
spinBoxValue = self.ui.spinBoxLeft.value() |
250 | 251 |
items[0].setRect(QRectF(spinBoxValue, rect.y(), rect.width(), rect.height())) |
252 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2)) |
|
251 | 253 |
elif spinBoxName == 'spinBoxTop': |
252 | 254 |
spinBoxValue = self.ui.spinBoxTop.value() |
253 | 255 |
items[0].setRect(QRectF(rect.x(), spinBoxValue, rect.width(), rect.height())) |
256 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2)) |
|
254 | 257 |
elif spinBoxName == 'spinBoxWidth': |
255 | 258 |
spinBoxValue = self.ui.spinBoxWidth.value() |
256 | 259 |
items[0].setRect(QRectF(rect.x(), rect.y(), spinBoxValue, rect.height())) |
260 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2)) |
|
257 | 261 |
elif spinBoxName == 'spinBoxHeight': |
258 | 262 |
spinBoxValue = self.ui.spinBoxHeight.value() |
259 | 263 |
items[0].setRect(QRectF(rect.x(), rect.y(), rect.width(), spinBoxValue)) |
264 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2)) |
|
260 | 265 |
|
261 | 266 |
rect = items[0].rect() |
262 | 267 |
bound.setRect(rect) |
내보내기 Unified diff