From 162d43e1c942032dbd563bc44b35092966bf32c7 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Wed, 12 Aug 2026 10:31:04 +1200 Subject: [PATCH] Fix PDF export truncating project filenames at the first dot Forum report (qelectrotech.org/forum, topic 3005, reporter oc67): a project named e.g. "Mon_projet.avec_un_point.qet" exported to PDF as "Mon_projet.pdf" - everything after the first "." in the filename was silently dropped. Root cause: ProjectPrintWindow::docName() used QFileInfo::baseName(), which returns the filename up to the FIRST "." rather than stripping only the final suffix. docName() feeds both the PDF print job's setOutputFileName() and the QFileDialog::getSaveFileName default in exportToPDF(), so the truncation showed up as the actual exported file's name, not just a dialog suggestion. sources/exportdialog.cpp's SVG/PNG/DXF export path already uses the correct QFileInfo::completeBaseName() (strips only the last suffix) - this fix brings the PDF/print path in line with that existing, correct pattern rather than introducing a new approach. Verified the exact before/after behavior with a standalone QFileInfo test: baseName() on "Mon_projet.avec_un_point.qet" returns "Mon_projet" (the bug); completeBaseName() returns "Mon_projet.avec_un_point" (correct). Also did a clean incremental build with no new warnings/errors. --- sources/print/projectprintwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/print/projectprintwindow.cpp b/sources/print/projectprintwindow.cpp index b115ad5b7..a2b1f3ce8 100644 --- a/sources/print/projectprintwindow.cpp +++ b/sources/print/projectprintwindow.cpp @@ -108,7 +108,7 @@ QString ProjectPrintWindow::docName(QETProject *project) { QString doc_name; if (!project->filePath().isEmpty()) { - doc_name = QFileInfo(project->filePath()).baseName(); + doc_name = QFileInfo(project->filePath()).completeBaseName(); } else if (!project->title().isEmpty()) { doc_name = project->title(); doc_name = QET::stringToFileName(doc_name);