Folio properties: auto-add a title block's custom variables (#271)

When a title block template uses custom variables (e.g. %{department},
%{owner}), the user previously had to declare each one by hand in the
folio properties 'Custom' tab before a value could be entered. Now the
template's undefined custom variables are added automatically, so the
user only fills in the values.

- listOfVariables() now extracts %{name} placeholders with a regex
  (deduplicated) instead of a crude '%' strip that returned '{name}'.
- The folio properties widget merges the template's custom variables into
  the Custom tab both on open (setProperties) and when the template is
  changed, preserving any values already entered and skipping the
  standard fields (title, author, date, ...) which have their own inputs.

Fixes #271 (variable auto-population; the revision-history request in the
thread is a separate feature).
This commit is contained in:
Shane Ringrose
2026-06-12 05:45:08 +12:00
parent e7787daa2c
commit ba6320bff8
3 changed files with 72 additions and 22 deletions
+3
View File
@@ -30,6 +30,7 @@ class NumerotationContext;
class QETProject;
class QMenu;
class TitleBlockTemplatesCollection;
class TitleBlockTemplate;
namespace Ui {
class TitleBlockPropertiesWidget;
@@ -77,6 +78,8 @@ class TitleBlockPropertiesWidget : public QWidget
void initDialog(const bool &current_date, QETProject *project);
int getIndexFor (const QString &tbt_name,
const QET::QetCollection collection) const;
TitleBlockTemplate *templateForIndex (int index) const;
void addTemplateVariables (DiagramContext &context, int index) const;
private slots:
void editCurrentTitleBlockTemplate();