Try dynamically loading screen
parent
5503a5705a
commit
e51670a573
|
@ -25,6 +25,7 @@ from PyQt5 import QtCore, QtGui
|
|||
from qdarkstyle.palette import DarkPalette
|
||||
|
||||
from ..log import get_logger
|
||||
from ._exec import current_screen
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
|
@ -51,6 +52,10 @@ class DpiAwareFont:
|
|||
self._qfont.setPixelSize(px_size)
|
||||
self._qfm = QtGui.QFontMetrics(self._qfont)
|
||||
|
||||
@property
|
||||
def screen(self) -> QtGui.QScreen:
|
||||
return current_screen()
|
||||
|
||||
@property
|
||||
def font(self):
|
||||
return self._qfont
|
||||
|
@ -82,7 +87,7 @@ class DpiAwareFont:
|
|||
|
||||
def boundingRect(self, value: str) -> QtCore.QRectF:
|
||||
|
||||
screen = self._screen
|
||||
screen = self.screen
|
||||
if screen is None:
|
||||
raise RuntimeError("You must call .configure_to_dpi() first!")
|
||||
|
||||
|
|
Loading…
Reference in New Issue