mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-06 19:54:13 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user