9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 import sys |
12 import sys |
13 |
13 |
14 from PyQt4.QtCore import pyqtSignal, QRectF, QSize, QSizeF, Qt |
14 from PyQt5.QtCore import pyqtSignal, QRectF, QSize, QSizeF, Qt |
15 from PyQt4.QtGui import QGraphicsView, QBrush, QPainter, QPixmap, QFont, QColor |
15 from PyQt5.QtGui import QBrush, QPainter, QPixmap, QFont, QColor |
|
16 from PyQt5.QtWidgets import QGraphicsView |
16 |
17 |
17 import Preferences |
18 import Preferences |
18 |
19 |
19 |
20 |
20 class E5GraphicsView(QGraphicsView): |
21 class E5GraphicsView(QGraphicsView): |
258 # step 2: grab the diagram |
259 # step 2: grab the diagram |
259 if format == "PNG": |
260 if format == "PNG": |
260 paintDevice = QPixmap(int(rect.width()), int(rect.height())) |
261 paintDevice = QPixmap(int(rect.width()), int(rect.height())) |
261 paintDevice.fill(self.backgroundBrush().color()) |
262 paintDevice.fill(self.backgroundBrush().color()) |
262 else: |
263 else: |
263 from PyQt4.QtSvg import QSvgGenerator |
264 from PyQt5.QtSvg import QSvgGenerator |
264 paintDevice = QSvgGenerator() |
265 paintDevice = QSvgGenerator() |
265 paintDevice.setResolution(100) # 100 dpi |
266 paintDevice.setResolution(100) # 100 dpi |
266 paintDevice.setSize(QSize(int(rect.width()), int(rect.height()))) |
267 paintDevice.setSize(QSize(int(rect.width()), int(rect.height()))) |
267 paintDevice.setViewBox(rect) |
268 paintDevice.setViewBox(rect) |
268 paintDevice.setFileName(filename) |
269 paintDevice.setFileName(filename) |