--- a/eric6/Graphics/ClassItem.py Sun Apr 12 15:03:27 2020 +0200 +++ b/eric6/Graphics/ClassItem.py Sun Apr 12 18:40:37 2020 +0200 @@ -75,22 +75,31 @@ ItemType = "class" def __init__(self, model=None, external=False, x=0, y=0, - rounded=False, noAttrs=False, parent=None, scene=None): + rounded=False, noAttrs=False, colors=None, parent=None, + scene=None): """ Constructor - @param model class model containing the class data (ClassModel) + @param model class model containing the class data + @type ClassModel @param external flag indicating a class defined outside our scope - (boolean) - @param x x-coordinate (integer) - @param y y-coordinate (integer) - @keyparam rounded flag indicating a rounded corner (boolean) - @keyparam noAttrs flag indicating, that no attributes should be shown - (boolean) - @keyparam parent reference to the parent object (QGraphicsItem) - @keyparam scene reference to the scene object (QGraphicsScene) + @type boolean + @param x x-coordinate + @type int + @param y y-coordinate + @type int + @param rounded flag indicating a rounded corner + @type bool + @param noAttrs flag indicating, that no attributes should be shown + @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 + @param scene reference to the scene object + @type QGraphicsScene """ - UMLItem.__init__(self, model, x, y, rounded, parent) + UMLItem.__init__(self, model, x, y, rounded, colors, parent) self.external = external self.noAttrs = noAttrs @@ -117,6 +126,7 @@ x = self.margin + self.rect().x() y = self.margin + self.rect().y() self.header = QGraphicsSimpleTextItem(self) + self.header.setBrush(self._colors[0]) self.header.setFont(boldFont) self.header.setText(self.model.getName()) self.header.setPos(x, y) @@ -127,6 +137,7 @@ else: txt = " " self.attrs = QGraphicsSimpleTextItem(self) + self.attrs.setBrush(self._colors[0]) self.attrs.setFont(self.font) self.attrs.setText(txt) self.attrs.setPos(x, y) @@ -138,6 +149,7 @@ else: txt = " " self.meths = QGraphicsSimpleTextItem(self) + self.meths.setBrush(self._colors[0]) self.meths.setFont(self.font) self.meths.setText(txt) self.meths.setPos(x, y)