프로젝트

일반

사용자정보

개정판 ea0ccb6f

IDea0ccb6f97c0cabec263c09ec004b01dff0a7672
상위 acc443f1
하위 d8c55909

함의성이(가) 11달 전에 추가함

add line no multi selection funct

Change-Id: I13813ea1a058888bf59189108b88eba4119a738a

차이점 보기:

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 139
                if symbols:
139 140
                    for item in symbols:
140 141
                        if len(symbols) == 1 or (len(symbols) != 1 and type(item) is not QEngineeringEquipmentItem):
141 142
                            item.keyPressEvent(event)
142
                if not symbols:
143
                if lineNos:
144
                    for item in lineNos:
145
                        item.keyPressEvent(event)
146
                if not symbols and not lineNos:
143 147
                    for item in lines:
144 148
                        item.keyPressEvent(event)
145 149
                event.accept()
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py
202 202
            showAction.triggered.connect(self.contextShow)
203 203
            menu.addAction(showAction)
204 204

  
205
            allAction = QAction('Select All in View(A)', None)
206
            allAction.triggered.connect(self.contextSelectAll)
207
            menu.addAction(allAction)
208

  
205 209
            highlightAction = QAction('Highlight', None)
206 210
            highlightAction.triggered.connect(lambda: self.contextHighlight(self))
207 211
            menu.addAction(highlightAction)
......
230 234

  
231 235
            menu.exec_(event.screenPos())
232 236

  
237
    def contextSelectAll(self):
238
        from App import App
239
        
240
        rect = App.mainWnd().graphicsView.viewport().rect()
241
        view_rect = App.mainWnd().graphicsView.mapToScene(rect).boundingRect()
242
        lineNos = [item for item in self.scene().items() if type(item) is QEngineeringLineNoTextItem and view_rect.contains(item.sceneBoundingRect().center())]
243
        for lineNo in lineNos:
244
            lineNo.setSelected(True)
245

  
233 246
    def contextShow(self):
234 247
        self.lineNoFromToIndicatorShowFlag = not self.lineNoFromToIndicatorShowFlag
235 248
        if self.lineNoFromToIndicatorShowFlag:
......
360 373
            self.contextTo()
361 374
        elif event.key() == Qt.Key_H:
362 375
            self.contextShow()
376
        elif event.key() == Qt.Key_A:
377
            self.contextSelectAll()
363 378

  
364 379
        QEngineeringTextItem.keyPressEvent(self, event)
365 380

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)