--- a/eric6/Graphics/UMLItem.py Sun Apr 12 15:03:27 2020 +0200 +++ b/eric6/Graphics/UMLItem.py Sun Apr 12 18:40:37 2020 +0200 @@ -9,6 +9,7 @@ from PyQt5.QtCore import Qt, QSizeF +from PyQt5.QtGui import QColor, QPen from PyQt5.QtWidgets import QGraphicsItem, QGraphicsRectItem, QStyle import Preferences @@ -41,19 +42,33 @@ """ ItemType = "UMLItem" - def __init__(self, model=None, x=0, y=0, rounded=False, parent=None): + def __init__(self, model=None, x=0, y=0, rounded=False, colors=None, + parent=None): """ Constructor - @param model UML model containing the item data (UMLModel) - @param x x-coordinate (integer) - @param y y-coordinate (integer) - @param rounded flag indicating a rounded corner (boolean) - @keyparam parent reference to the parent object (QGraphicsItem) + @param model UML model containing the item data + @type UMLModel + @param x x-coordinate + @type int + @param y y-coordinate + @type int + @param rounded flag indicating a rounded corner + @type bool + @param colors tuple containing the foreground and background colors + @type tuple of (QColor, QColor) + @param parent reference to the parent object + @type QGraphicsItem """ super(UMLItem, self).__init__(parent) self.model = model + if colors is None: + self._colors = (QColor(Qt.black), QColor(Qt.white)) + else: + self._colors = colors + self.setPen(QPen(self._colors[0])) + # TODO: set pen according to user selected color self.font = Preferences.getGraphics("Font") self.margin = 5