diff options
| author | tassaron | 2017-05-28 14:49:35 -0400 |
|---|---|---|
| committer | tassaron | 2017-05-28 14:49:35 -0400 |
| commit | 5101b439dfcbedf0dbdba3ee867c11c063cee51a (patch) | |
| tree | 44a27d1ace2e45d76967e65ca762cc8a6d59f7c4 | |
| parent | 5ed79ff5c62ba704a96c5d96641a4a5733b53c1e (diff) | |
fixed travelling text bug
| -rw-r--r-- | components/text.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/components/text.py b/components/text.py index 814e13f..eab33b2 100644 --- a/components/text.py +++ b/components/text.py @@ -63,6 +63,14 @@ class Component: self.xPosition = self.page.spinBox_xTextAlign.value() self.yPosition = self.page.spinBox_yTextAlign.value() self.textColor = RGBFromString(self.page.lineEdit_textColor.text()) + fm = QtGui.QFontMetrics(self.titleFont) + if self.alignment == 0: #Left + self.xPosition = self.xPosition + if self.alignment == 1: #Middle + self.xPosition = self.xPosition - fm.width(self.title)/2 + if self.alignment == 2: #Right + self.xPosition = self.xPosition - fm.width(self.title) + self.parent.drawPreview() def previewRender(self, previewWorker): @@ -90,12 +98,6 @@ class Component: painter.setPen(QColor(*self.textColor)) fm = QtGui.QFontMetrics(self.titleFont) - if self.alignment == 0: #Left - self.xPosition = self.xPosition - if self.alignment == 1: #Middle - self.xPosition = self.xPosition - fm.width(self.title)/2 - if self.alignment == 2: #Right - self.xPosition = self.xPosition - fm.width(self.title) painter.drawText(self.xPosition, self.yPosition, self.title) painter.end() |
