From 95e6d049fd23ba1919d8b67d2071d57a422bdc85 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 22 Nov 2011 18:42:32 +0100 Subject: fixed the arrow thing --- src/editorui/paths.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/editorui/paths.py') diff --git a/src/editorui/paths.py b/src/editorui/paths.py index ad81fa0..8b45ea9 100644 --- a/src/editorui/paths.py +++ b/src/editorui/paths.py @@ -307,34 +307,38 @@ class KPEditorPath(QtGui.QGraphicsLineItem): def paintEvent(self, event): - painter = QtGui.QPainter(self) + contentsRect = self.contentsRect() if self.path > 0: painter.save() + displaceX, displaceY = contentsRect.width() / 2, contentsRect.height() / 2 + pathItem = self._pathRef().qtItem.line() if self.path == 1: - angle = pathItem.angle() + angle = 90 - pathItem.angle() else: - angle = 180 + pathItem.angle() + angle = 270 - pathItem.angle() + painter.translate(displaceX, displaceY) painter.rotate(angle) - self.arrowIcon.paint(painter, self.contentsRect(), Qt.AlignCenter) + painter.translate(-displaceX, -displaceY) + self.arrowIcon.paint(painter, contentsRect, Qt.AlignCenter) painter.restore() if self.isDown(): - self.iconList[self.secret].paint(painter, self.contentsRect(), Qt.AlignCenter, QtGui.QIcon.Disabled) + self.iconList[self.secret].paint(painter, contentsRect, Qt.AlignCenter, QtGui.QIcon.Disabled) else: - self.iconList[self.secret].paint(painter, self.contentsRect(), Qt.AlignCenter) + self.iconList[self.secret].paint(painter, contentsRect, Qt.AlignCenter) else: if self.isDown(): - self.unlockIcon.paint(painter, self.contentsRect(), Qt.AlignCenter, QtGui.QIcon.Disabled) + self.unlockIcon.paint(painter, contentsRect, Qt.AlignCenter, QtGui.QIcon.Disabled) else: - self.unlockIcon.paint(painter, self.contentsRect(), Qt.AlignCenter) + self.unlockIcon.paint(painter, contentsRect, Qt.AlignCenter) painter.end() -- cgit v1.2.3