(self, event)
| 2434 | self._pre_drag_pos = {} |
| 2435 | |
| 2436 | def mouseDoubleClickEvent(self, event): |
| 2437 | if self._mode == _Mode.DRAWING_LINE and event.button() == Qt.LeftButton: |
| 2438 | # The first click of the double-click already added the final point |
| 2439 | # via mousePressEvent; commit if we have at least 2 points. |
| 2440 | if len(self._draw_pts) >= 2: |
| 2441 | self._commit_shape(self._draw_pts[-1]) |
| 2442 | return |
| 2443 | if self._mode != _Mode.NORMAL: |
| 2444 | super().mouseDoubleClickEvent(event) |
| 2445 | return |
| 2446 | if event.button() != Qt.LeftButton: |
| 2447 | return |
| 2448 | item = self.itemAt(event.scenePos(), QTransform()) |
| 2449 | # BorderItem.shape() covers only the edge; itemAt() misses interior |
| 2450 | # clicks on an otherwise empty area. Only fall back to a bounding-rect |
| 2451 | # check when nothing else was found at the click position. |
| 2452 | if item is None: |
| 2453 | sp = event.scenePos() |
| 2454 | for candidate in self.items(): |
| 2455 | if isinstance(candidate, BorderItem): |
| 2456 | if candidate.rect().contains(candidate.mapFromScene(sp)): |
| 2457 | item = candidate |
| 2458 | break |
| 2459 | if isinstance(item, BorderItem): |
| 2460 | from .border_dialog import BorderDialog |
| 2461 | r = item.rect() |
| 2462 | dlg = BorderDialog( |
| 2463 | width=int(r.width()), |
| 2464 | height=int(r.height()), |
| 2465 | show_in_export=item.show_in_export, |
| 2466 | ) |
| 2467 | if dlg.exec(): |
| 2468 | self._push_undo() |
| 2469 | item.setRect(0, 0, dlg.border_width(), dlg.border_height()) |
| 2470 | item.show_in_export = dlg.show_in_export() |
| 2471 | return |
| 2472 | if isinstance(item, LibraryItem): |
| 2473 | from .library_link_dialog import LibraryLinkDialog |
| 2474 | dlg = LibraryLinkDialog( |
| 2475 | directive=item.directive, |
| 2476 | simulator=item.simulator, |
| 2477 | file_path=item.file_path, |
| 2478 | corner=item.corner, |
| 2479 | ) |
| 2480 | if dlg.exec() and dlg.file_path(): |
| 2481 | self._push_undo() |
| 2482 | item.file_path = dlg.file_path() |
| 2483 | item.directive = dlg.directive() |
| 2484 | item.simulator = dlg.simulator() |
| 2485 | item.corner = dlg.corner() |
| 2486 | item._update_text() |
| 2487 | return |
| 2488 | if isinstance(item, ImageItem): |
| 2489 | from .image_dialog import ImageDialog |
| 2490 | dlg = ImageDialog( |
| 2491 | file_path=item.file_path, |
| 2492 | display_width=item.display_width, |
| 2493 | display_height=item.display_height, |
nothing calls this directly
no test coverage detected