Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/matplotlib/backends/backend_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,12 @@ def pixmap(self, size, mode, state):

def _devicePixelRatio(self):
"""Return the current device pixel ratio for the toolbar, defaulting to 1."""
return (self.toolbar.devicePixelRatioF() or 1) if self.toolbar else 1
use_high_dpi_pixmaps = True
if hasattr(QtCore.Qt.ApplicationAttribute, "AA_UseHighDpiPixmaps"):
app = QtWidgets.QApplication.instance()
use_high_dpi_pixmaps = app.testAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
toolbar_dpr = (self.toolbar.devicePixelRatioF() or 1) if self.toolbar else 1
return toolbar_dpr if use_high_dpi_pixmaps else 1

def _create_pixmap_from_svg(self, svg_path, size):
"""Create a pixmap from SVG with proper scaling and dark mode support."""
Expand Down
Loading