From ce6a88c98ceda9b0851122a09daa081969148f1a Mon Sep 17 00:00:00 2001 From: ispyisail Date: Tue, 6 Oct 2026 22:32:43 +1300 Subject: [PATCH] Fix the MSVC build: QPrinter built through ?: in live mode print MSVC stopped with C2280 at liveserver.cpp:861 (issue #1333): it copies the result of the ?: expression, and QPrinter cannot be copied. GCC and Clang build the object in place under C++17, so Linux and CI built. QPrinter(info) gives the same printer in both cases: info is only set when printing to a printer, and QPrinter() itself constructs with an empty QPrinterInfo (qprinter.cpp, QPrinter::QPrinter(PrinterMode)). Co-Authored-By: Claude Opus 5.5 --- sources/scripting/liveserver.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/scripting/liveserver.cpp b/sources/scripting/liveserver.cpp index da9ccc352..f76aaaaec 100644 --- a/sources/scripting/liveserver.cpp +++ b/sources/scripting/liveserver.cpp @@ -858,7 +858,9 @@ QJsonObject LiveServer::print(const QJsonObject &request) if (fi.exists()) return failure(QStringLiteral("%1 already exists; printing never replaces a file").arg(file)); } - QPrinter printer = file.isEmpty() ? QPrinter(info) : QPrinter(); + //info is still null when printing to a file, which is what QPrinter() + //uses. No ?: here: MSVC copies its result, and QPrinter cannot be copied + QPrinter printer(info); //96 dpi, as the PDF export draws: symbols are replayed at the //device's resolution, so at a printer's 600-1200 dpi they came out //many times too big next to the wires (seen on a test print)