개정판 0e17caa8
add text space remove funct
Change-Id: I5056c558cc5ef8ccdf1c8768bc892a84355b6e0f
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
246 | 246 |
if len(items) > 0 and self in items: |
247 | 247 |
menu = QMenu() |
248 | 248 |
|
249 |
editAction = QAction('Edit(Return)', None) |
|
250 |
editAction.triggered.connect(self.contextEdit) |
|
251 |
menu.addAction(editAction) |
|
252 |
|
|
253 | 249 |
if len(items) > 1: |
254 | 250 |
mergeAction = QAction('Merge(M)', None) |
255 | 251 |
mergeAction.triggered.connect(self.contextMerge) |
256 | 252 |
menu.addAction(mergeAction) |
257 | 253 |
|
258 | 254 |
if len(items) == 1: |
255 |
editAction = QAction('Edit(Return)', None) |
|
256 |
editAction.triggered.connect(self.contextEdit) |
|
257 |
menu.addAction(editAction) |
|
258 |
|
|
259 | 259 |
rotateAction = QAction('Rotate(R)', None) |
260 | 260 |
rotateAction.triggered.connect(self.contextRotate) |
261 | 261 |
menu.addAction(rotateAction) |
262 | 262 |
|
263 |
if len(items) >= 1: |
|
264 |
trimAction = QAction('Remove Space', None) |
|
265 |
trimAction.triggered.connect(self.contextTrim) |
|
266 |
menu.addAction(trimAction) |
|
267 |
|
|
263 | 268 |
deleteAction = QAction('Delete(E)', None) |
264 | 269 |
deleteAction.triggered.connect(self.contextDelete) |
265 | 270 |
menu.addAction(deleteAction) |
266 | 271 |
|
267 | 272 |
menu.exec_(event.screenPos()) |
268 | 273 |
|
274 |
def contextTrim(self): |
|
275 |
textItems = [item for item in self.scene().selectedItems() if type(item) is QEngineeringTextItem] |
|
276 |
|
|
277 |
for text in textItems: |
|
278 |
text.setPlainText(text.text().replace(' ', '')) |
|
279 |
|
|
269 | 280 |
def contextMerge(self): |
270 | 281 |
event = QKeyEvent(QEvent.KeyPress, Qt.Key_M, Qt.NoModifier) |
271 | 282 |
self.keyPressEvent(event) |
내보내기 Unified diff