개정판 0e98d54b
text selection
Change-Id: Ief1814570e57c95bb711359dd6a047e37f2f188d
DTI_PID/DTI_PID/QtImageViewerScene.py | ||
---|---|---|
135 | 135 |
elif event.key() == Qt.Key_A: |
136 | 136 |
lines = [item for item in self.selectedItems() if type(item) == QEngineeringLineItem] |
137 | 137 |
symbols = [item for item in self.selectedItems() if issubclass(type(item), SymbolSvgItem)] |
138 |
lineNos = [item for item in self.selectedItems() if type(item) == QEngineeringLineNoTextItem]
|
|
138 |
texts = [item for item in self.selectedItems() if issubclass(type(item), QEngineeringTextItem)]
|
|
139 | 139 |
if symbols: |
140 | 140 |
for item in symbols: |
141 | 141 |
if len(symbols) == 1 or (len(symbols) != 1 and type(item) is not QEngineeringEquipmentItem): |
142 | 142 |
item.keyPressEvent(event) |
143 |
if lineNos:
|
|
144 |
for item in lineNos:
|
|
143 |
if texts:
|
|
144 |
for item in texts:
|
|
145 | 145 |
item.keyPressEvent(event) |
146 |
if not symbols and not lineNos:
|
|
146 |
if not symbols and not texts:
|
|
147 | 147 |
for item in lines: |
148 | 148 |
item.keyPressEvent(event) |
149 | 149 |
event.accept() |
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
270 | 270 |
menu.addAction(alignAction) |
271 | 271 |
|
272 | 272 |
if len(items) == 1: |
273 |
allAction = QAction('Select All in View(A)', None) |
|
274 |
allAction.triggered.connect(self.contextSelectAll) |
|
275 |
menu.addAction(allAction) |
|
276 |
|
|
273 | 277 |
editAction = QAction('Edit(Return)', None) |
274 | 278 |
editAction.triggered.connect(self.contextEdit) |
275 | 279 |
menu.addAction(editAction) |
... | ... | |
289 | 293 |
|
290 | 294 |
menu.exec_(event.screenPos()) |
291 | 295 |
|
296 |
def contextSelectAll(self): |
|
297 |
from QEngineeringSizeTextItem import QEngineeringSizeTextItem |
|
298 |
from App import App |
|
299 |
|
|
300 |
rect = App.mainWnd().graphicsView.viewport().rect() |
|
301 |
view_rect = App.mainWnd().graphicsView.mapToScene(rect).boundingRect() |
|
302 |
lineNos = [item for item in self.scene().items() if type(item) is type(self) and view_rect.contains(item.sceneBoundingRect().center())] |
|
303 |
for lineNo in lineNos: |
|
304 |
lineNo.setSelected(True) |
|
305 |
|
|
292 | 306 |
def contextResizeText(self): |
293 | 307 |
from QEngineeringTrimLineNoTextItem import QEngineeringLineNoTextItem |
294 | 308 |
|
... | ... | |
418 | 432 |
from App import App |
419 | 433 |
|
420 | 434 |
App.mainWnd().keyPressEvent(event) |
435 |
elif event.key() == Qt.Key_A: |
|
436 |
self.contextSelectAll() |
|
421 | 437 |
|
422 | 438 |
# QGraphicsTextItem.keyPressEvent(self, event) |
423 | 439 |
|
내보내기 Unified diff