개정판 78ca21fd
issue #643: add text remove
Change-Id: I04e498a2ee40360c792da64fe1436a76be0d89e0
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
167 | 167 |
''' |
168 | 168 |
|
169 | 169 |
def keyPressEvent(self, event): |
170 |
if self.isSelected() and event.key() == Qt.Key_Delete: |
|
171 |
self.deleteTextItemFromScene() |
|
172 |
elif event.key() == Qt.Key_R: |
|
170 |
if event.key() == Qt.Key_R: |
|
173 | 171 |
# degree 0 |
174 | 172 |
if 0 == self.angle: |
175 | 173 |
self.angle = 1.57 |
... | ... | |
257 | 255 |
''' |
258 | 256 |
|
259 | 257 |
def deleteTextItemFromScene(self): |
258 |
''' not used ''' |
|
260 | 259 |
# self.transfer.onRemoved.emit(self) |
261 | 260 |
self.scene().removeItem(self) |
262 | 261 |
|
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
1002 | 1002 |
|
1003 | 1003 |
if not self.isSelected(): |
1004 | 1004 |
return |
1005 |
if event.key() == Qt.Key_Delete: |
|
1006 |
self.deleteSvgItemFromScene() |
|
1007 |
elif event.key() == Qt.Key_B: |
|
1005 |
if event.key() == Qt.Key_B: |
|
1008 | 1006 |
self.bind_close_items() |
1009 | 1007 |
elif event.key() == Qt.Key_R and type(self) is not QEngineeringErrorItem: |
1010 | 1008 |
self.rotateSymbol() |
... | ... | |
1904 | 1902 |
''' |
1905 | 1903 |
|
1906 | 1904 |
def deleteSvgItemFromScene(self): |
1905 |
''' not used ''' |
|
1907 | 1906 |
for connector in self.connectors: |
1908 | 1907 |
if connector.connectedItem is not None: |
1909 | 1908 |
try: |
DTI_PID/DTI_PID/TextItemEditDialog.py | ||
---|---|---|
87 | 87 |
text_find = self.ui.lineEditFindText.text() |
88 | 88 |
replace = self.ui.lineEditReplaceText.text() |
89 | 89 |
model = self.ui.tableViewResult.model() |
90 |
if replace and model.rowCount():
|
|
90 |
if model.rowCount(): |
|
91 | 91 |
messages = [] |
92 | 92 |
for row in range(model.rowCount()): |
93 | 93 |
item = self.ui.tableViewResult.model().item(row, 0) |
... | ... | |
96 | 96 |
text = data.text() |
97 | 97 |
messages.append(f"replaced: {text} --> {text.replace(text_find, replace)}") |
98 | 98 |
data.setPlainText(text.replace(text_find, replace)) |
99 |
if not data.text(): |
|
100 |
data.transfer.onRemoved.emit(data) |
|
99 | 101 |
|
100 | 102 |
if messages: |
101 | 103 |
QMessageBox.information(self, self.tr('Information'), '\r\n'.join(messages)) |
내보내기 Unified diff