File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747import os
4848import struct
4949
50+ from qtpy .QtCore import QRectF , QSize , QSizeF , Qt
5051from qtpy .QtGui import (
51- QPainter ,
52- QPalette ,
52+ QAbstractTextDocumentLayout ,
53+ QColor ,
5354 QFont ,
55+ QFontInfo ,
5456 QFontMetrics ,
55- QColor ,
56- QTextDocument ,
57- QTextOption ,
5857 QFontMetricsF ,
58+ QPainter ,
59+ QPalette ,
5960 QPixmap ,
60- QFontInfo ,
61+ QTextDocument ,
62+ QTextOption ,
6163 QTransform ,
62- QAbstractTextDocumentLayout ,
6364)
64- from qtpy .QtWidgets import QFrame , QWidget , QSizePolicy , QApplication
65- from qtpy .QtCore import Qt , QSizeF , QSize , QRectF
65+ from qtpy .QtWidgets import QApplication , QFrame , QSizePolicy , QWidget
6666
6767from qwt .painter import QwtPainter
6868from qwt .qthelpers import qcolor_from_str
@@ -206,7 +206,10 @@ def qwtUnscaleFont(painter):
206206 dpix , dpiy = get_screen_resolution ()
207207 pd = painter .device ()
208208 if pd .logicalDpiX () != dpix or pd .logicalDpiY () != dpiy :
209- pixelFont = QFont (painter .font (), QApplication .desktop ())
209+ try :
210+ pixelFont = QFont (painter .font (), QApplication .desktop ())
211+ except AttributeError :
212+ pixelFont = QFont (painter .font ())
210213 pixelFont .setPixelSize (QFontInfo (pixelFont ).pixelSize ())
211214 painter .setFont (pixelFont )
212215
You can’t perform that action at this time.
0 commit comments