From ffe10324fa03d603641eddb4e636aded692a8b48 Mon Sep 17 00:00:00 2001 From: Pierre Raybaut Date: Mon, 16 Oct 2023 19:07:13 +0200 Subject: [PATCH] Fixed QPrinter.setColorMode for PyQt6/Linux --- qwt/plot_renderer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qwt/plot_renderer.py b/qwt/plot_renderer.py index 8954295..112c9de 100644 --- a/qwt/plot_renderer.py +++ b/qwt/plot_renderer.py @@ -249,7 +249,11 @@ def renderDocument( printer.setPrinterName("") else: printer.setOutputFormat(QPrinter.PostScriptFormat) - printer.setColorMode(QPrinter.Color) + try: + printer.setColorMode(QPrinter.Color) + except AttributeError: + # PyQt6 on Linux + pass printer.setFullPage(True) printer.setPageSize(QPageSize(sizeMM, QPageSize.Millimeter)) printer.setDocName(title)