From 7988cf25a52d26109e60fe5a7b72ec2940c59ecc Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 18 Oct 2022 17:29:23 +0200 Subject: [PATCH] Avoid warning from QPrinter::setFromTo() in the documented 0,0 case The doc says the setFromTo(0, 0) will print the whole document, i.e. clear the page ranges. Although this works, it creates a runtime warning. Fixes: QTBUG-105292 Pick-to: 6.4 Change-Id: Ic5de5be71ffc91762c8a4a44875ba133831d981f Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/printsupport/kernel/qprinter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 66fc883cae..e591b51aee 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -1410,7 +1410,8 @@ int QPrinter::toPage() const void QPrinter::setFromTo(int from, int to) { d->pageRanges.clear(); - d->pageRanges.addRange(from, to); + if (from && to) + d->pageRanges.addRange(from, to); } /*!