src/eric7/Graphics/UMLGraphicsView.py

branch
eric7
changeset 10069
435cc5875135
parent 9695
ad962e9b904d
child 10439
21c28b0f9e41
equal deleted inserted replaced
10068:7febcdccb2a1 10069:435cc5875135
7 Module implementing a subclass of EricGraphicsView for our diagrams. 7 Module implementing a subclass of EricGraphicsView for our diagrams.
8 """ 8 """
9 9
10 import pathlib 10 import pathlib
11 11
12 from PyQt6.QtCore import QEvent, QMarginsF, QRectF, QSignalMapper, Qt, pyqtSignal 12 from PyQt6.QtCore import (
13 QEvent,
14 QMarginsF,
15 QRectF,
16 QSignalMapper,
17 Qt,
18 pyqtSignal,
19 pyqtSlot,
20 )
13 from PyQt6.QtGui import QAction, QPageLayout 21 from PyQt6.QtGui import QAction, QPageLayout
14 from PyQt6.QtPrintSupport import QPrintDialog, QPrinter, QPrintPreviewDialog 22 from PyQt6.QtPrintSupport import QPrintDialog, QPrinter, QPrintPreviewDialog
15 from PyQt6.QtWidgets import QDialog, QGraphicsView, QToolBar 23 from PyQt6.QtWidgets import QDialog, QGraphicsView, QToolBar
16 24
17 from eric7 import Preferences 25 from eric7 import Preferences
78 def __initActions(self): 86 def __initActions(self):
79 """ 87 """
80 Private method to initialize the view actions. 88 Private method to initialize the view actions.
81 """ 89 """
82 self.alignMapper = QSignalMapper(self) 90 self.alignMapper = QSignalMapper(self)
83 try: 91 self.alignMapper.mappedInt.connect(self.__alignShapes)
84 self.alignMapper.mappedInt.connect(self.__alignShapes)
85 except AttributeError:
86 # pre Qt 5.15
87 self.alignMapper.mapped[int].connect(self.__alignShapes)
88 92
89 self.deleteShapeAct = QAction( 93 self.deleteShapeAct = QAction(
90 EricPixmapCache.getIcon("deleteShape"), self.tr("Delete shapes"), self 94 EricPixmapCache.getIcon("deleteShape"), self.tr("Delete shapes"), self
91 ) 95 )
92 self.deleteShapeAct.triggered.connect(self.__deleteShape) 96 self.deleteShapeAct.triggered.connect(self.__deleteShape)
197 if (sceneRect.height() - self.deltaSize) < diagramSize.height(): 201 if (sceneRect.height() - self.deltaSize) < diagramSize.height():
198 self.decHeightAct.setEnabled(False) 202 self.decHeightAct.setEnabled(False)
199 else: 203 else:
200 self.decHeightAct.setEnabled(True) 204 self.decHeightAct.setEnabled(True)
201 205
206 @pyqtSlot("QList<QRectF>")
202 def __sceneChanged(self, areas): 207 def __sceneChanged(self, areas):
203 """ 208 """
204 Private slot called when the scene changes. 209 Private slot called when the scene changes.
205 210
206 @param areas list of rectangles that contain changes 211 @param areas list of rectangles that contain changes
824 "associations": associations, 829 "associations": associations,
825 } 830 }
826 831
827 return data 832 return data
828 833
829 def fromDict(self, version, data): 834 def fromDict(self, version, data): # noqa: U100
830 """ 835 """
831 Public method to populate the class with data persisted by 'toDict()'. 836 Public method to populate the class with data persisted by 'toDict()'.
832 837
833 @param version version of the data 838 @param version version of the data
834 @type str 839 @type str

eric ide

mercurial