Fix title blocks cutting project file names at the first dot

A project saved as "my.project.qet" showed "my" in every title block
cell using %{projectfilename}, and "my" again in %{savedfilename} after
a save. QETProject used QFileInfo::baseName(), which stops at the first
"."; completeBaseName() strips only the ".qet" suffix. Same fix as
#725 made for the PDF export's file name.

Verified headlessly on examples/industrial.qet copied to
my.project.qet, with a title block cell set to %{projectfilename}:
--export-svg shows "my" on master and "my.project" with this change,
on all 50 folios. For %{savedfilename}, a --run script calling
qet.save("") twice writes "my" on master and "my.project" with this
change. ctest 32/32.

Not changed: write() updates the saved* variables after the file is
written, so the values stored in a file are those of the save before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-09-29 15:56:32 +13:00
parent 2801d93afd
commit 42fab5ad78
+3 -3
View File
@@ -580,7 +580,7 @@ void QETProject::setFilePath(const QString &filepath)
m_project_properties.addValue("saveddate-eu", QDate::currentDate().toString("dd-MM-yyyy"));
m_project_properties.addValue("saveddate-us", QDate::currentDate().toString("yyyy-MM-dd"));
m_project_properties.addValue("savedtime", QDateTime::currentDateTime().toString("HH:mm"));
m_project_properties.addValue("savedfilename", QFileInfo(filePath()).baseName());
m_project_properties.addValue("savedfilename", QFileInfo(filePath()).completeBaseName());
m_project_properties.addValue("savedfilepath", filePath());
@@ -1428,7 +1428,7 @@ QETResult QETProject::write()
m_project_properties.addValue("saveddate-us", QDate::currentDate().toString("yyyy-MM-dd"));
m_project_properties.addValue("saveddate-eu", QDate::currentDate().toString("dd-MM-yyyy"));
m_project_properties.addValue("savedtime", QDateTime::currentDateTime().toString("HH:mm"));
m_project_properties.addValue("savedfilename", QFileInfo(filePath()).baseName());
m_project_properties.addValue("savedfilename", QFileInfo(filePath()).completeBaseName());
m_project_properties.addValue("savedfilepath", filePath());
emit projectInformationsChanged(this);
@@ -2480,7 +2480,7 @@ void QETProject::updateDiagramsFolioData()
DiagramContext project_wide_properties = m_project_properties;
project_wide_properties.addValue("projecttitle", title());
project_wide_properties.addValue("projectpath", filePath());
project_wide_properties.addValue("projectfilename", QFileInfo(filePath()).baseName());
project_wide_properties.addValue("projectfilename", QFileInfo(filePath()).completeBaseName());
for (int i = 0 ; i < total_folio ; ++ i)
{