CLI export: disable the editor grid in rendered output

renderDiagram() had a no-op stub: was_drawing_grid was set to false and
Q_UNUSED'd, so the editor grid still leaked into exported PDF/PNG/SVG.
Toggle Diagram::setDisplayGrid(false) around the render and restore the
previous state afterwards. Fixes all three export formats (they share
renderDiagram).

Reported by scorpio810 on #483.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Shane Ringrose
2026-06-11 22:00:07 +12:00
parent 361719ca74
commit 42b64a7f0a
+6 -2
View File
@@ -74,9 +74,13 @@ QString diagramStem(Diagram *diagram, int index)
void renderDiagram(Diagram *diagram, QPainter &painter, const QRectF &target) void renderDiagram(Diagram *diagram, QPainter &painter, const QRectF &target)
{ {
const QRect source = diagramRect(diagram); const QRect source = diagramRect(diagram);
const bool was_drawing_grid = false; // export without the editor grid // Export without the editor grid: drawBackground() only paints it when
Q_UNUSED(was_drawing_grid) // draw_grid_ is set (default true), so toggle it off around the render
// and restore it afterwards.
const bool was_drawing_grid = diagram->displayGrid();
diagram->setDisplayGrid(false);
diagram->render(&painter, target, source, Qt::KeepAspectRatio); diagram->render(&painter, target, source, Qt::KeepAspectRatio);
diagram->setDisplayGrid(was_drawing_grid);
} }
int exportPdf(QETProject &project, const QString &output) int exportPdf(QETProject &project, const QString &output)