--- a/eric7/Graphics/ClassItem.py Sat Dec 04 11:49:27 2021 +0100 +++ b/eric7/Graphics/ClassItem.py Sat Dec 04 15:34:40 2021 +0100 @@ -161,14 +161,14 @@ attrs = self.model.getInstanceAttributes() meths = self.model.getMethods() - x = self.margin + self.rect().x() - y = self.margin + self.rect().y() + x = self.margin + int(self.rect().x()) + y = self.margin + int(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) - y += self.header.boundingRect().height() + self.margin + y += int(self.header.boundingRect().height()) + self.margin if self.external: self.classAttributes = None @@ -185,7 +185,8 @@ self.classAttributes.setFont(self.font) self.classAttributes.setText(txt) self.classAttributes.setPos(x, y) - y += self.classAttributes.boundingRect().height() + self.margin + y += (int(self.classAttributes.boundingRect().height()) + + self.margin) if not self.noAttrs and not self.external: txt = QCoreApplication.translate( @@ -200,7 +201,7 @@ self.attrs.setFont(self.font) self.attrs.setText(txt) self.attrs.setPos(x, y) - y += self.attrs.boundingRect().height() + self.margin + y += int(self.attrs.boundingRect().height()) + self.margin else: self.attrs = None @@ -226,19 +227,24 @@ if self.model is None: return - width = self.header.boundingRect().width() - height = self.header.boundingRect().height() + width = int(self.header.boundingRect().width()) + height = int(self.header.boundingRect().height()) if self.classAttributes: - width = max(width, self.classAttributes.boundingRect().width()) + width = max(width, + int(self.classAttributes.boundingRect().width())) height += ( - self.classAttributes.boundingRect().height() + self.margin + int(self.classAttributes.boundingRect().height()) + self.margin ) if self.attrs: - width = max(width, self.attrs.boundingRect().width()) - height = height + self.attrs.boundingRect().height() + self.margin + width = max(width, + int(self.attrs.boundingRect().width())) + height = ( + height + int(self.attrs.boundingRect().height()) + self.margin + ) if self.meths: - width = max(width, self.meths.boundingRect().width()) - height += self.meths.boundingRect().height() + width = max(width, + int(self.meths.boundingRect().width())) + height += int(self.meths.boundingRect().height()) self.setSize(width + 2 * self.margin, height + 2 * self.margin) @@ -288,20 +294,23 @@ painter.setBrush(self.brush()) painter.setFont(self.font) - offsetX = self.rect().x() - offsetY = self.rect().y() - w = self.rect().width() - h = self.rect().height() + offsetX = int(self.rect().x()) + offsetY = int(self.rect().y()) + w = int(self.rect().width()) + h = int(self.rect().height()) painter.drawRect(offsetX, offsetY, w, h) - y = self.margin + self.header.boundingRect().height() + y = self.margin + int(self.header.boundingRect().height()) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) if self.classAttributes: - y += self.margin + self.classAttributes.boundingRect().height() + y += ( + self.margin + + int(self.classAttributes.boundingRect().height()) + ) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) if self.attrs: - y += self.margin + self.attrs.boundingRect().height() + y += self.margin + int(self.attrs.boundingRect().height()) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y)