Skip to content
ispyisail edited this page Oct 7, 2026 · 3 revisions

Title block templates

The title block is the framed panel of drawing information in the corner of a sheet. Its layout is not hard-coded β€” it is a template, a .titleblock file, and you can edit or write your own.

QElectroTech ships ten templates and includes a dedicated editor for them.

Source: sources/titleblocktemplate.cpp, sources/titleblockcell.h, and sources/titleblock/ for the editor.


1. A template is a grid

A template is a grid of cells. Each cell is one of three types:

Type Shows
Text a label and a value, either of which may contain variables
Logo an image stored inside the template file
Empty nothing β€” it reserves space

Cells can span neighbouring rows and columns, so a wide title cell across the top and a stack of small cells below is just spanning.

Column widths use three kinds of length

This is the part of the format worth understanding, because it is what makes a template fit any paper size. The grid's cols attribute is a list of lengths, each with a prefix:

Written Means
120px; absolute β€” always 120 pixels
t22%; 22% of the total width available
r100%; 100% of the remaining width, after absolute and total-relative columns are taken out

So cols="t22%;r100%;t22%;" β€” the shipped default β€” is: a column of 22% of the width, then a column that absorbs everything left over, then another 22%. The middle column stretches and the outer two stay proportional, whatever the sheet's width.

Rows are always absolute, given as plain pixel heights: rows="25;25;". There is no relative row height.


2. Labels, values and translations

A text cell holds two pieces of text, and both are translatable:

<field row="0" col="0" name="author" align="left" valign="center"
       displaylabel="true" hadjust="true">
    <value>
        <translation lang="en">%author</translation>
    </value>
    <label>
        <translation lang="en">Author</translation>
        <translation lang="fr">Auteur</translation>
        <translation lang="de">Autor</translation>
    </label>
</field>
  • The label is the fixed caption β€” Author β€” and is normally translated into every language the template supports.
  • The value is what changes per sheet, and normally holds a variable. It usually needs only one entry, since %author is the same in every language.
  • displaylabel decides whether the caption is drawn at all. A big title cell typically sets it false.
  • name identifies the cell inside the template. It is not drawn.
  • hadjust shrinks the font when the text does not fit, rather than letting it overflow.

The shipped templates' English captions follow the English interface, which calls a folio a sheet: since PR #1216 (2 October 2026) their Folio caption reads Sheet in English. Only the English caption changed; the variable stays %folio, and the other languages are as before.


3. Variables

Title block cells use their own substitution, and it is more permissive than anywhere else in QET: every key in the sheet's context is replaced, in both the braced and bare forms. %{author} and %author both work.

Standard keys are the sheet's own fields: title, author, filename, folio, plant, locmach, indexrev, date, display_folio. Project properties and any custom sheet fields are substituted too β€” which is how a template can carry a field QET knows nothing about.

Two details:

  • Keys are substituted longest first, deliberately, so a key named plant cannot eat the front of %plantcode.
  • Only the braced form %{name} can be discovered. The editor builds its list of variables in use by scanning for %{…}; a bare %name still renders but nothing can enumerate it. Prefer the braced form when writing a template.

Project variables

Every sheet's title block can also show these, which come from the project rather than the sheet:

Variable Shows
%{projecttitle} the project's title
%{projectpath} the full path of the project file
%{projectfilename} the project file's name without .qet
%{savedfilename}, %{savedfilepath} the file name (without .qet) and full path at the last save
%{saveddate}, %{saveddate-eu}, %{saveddate-us}, %{savedtime} the date and time of the last save: in the system's short format, as dd-MM-yyyy, as yyyy-MM-dd, and as HH:mm

Only the .qet is taken off a file name, so a project saved as plant.line2.qet shows plant.line2. (Builds before PR #1140, merged 29 September 2026, cut the name at the first dot and showed plant.) The saved… values are worked out as the file is saved, so a project just opened shows those of its last save.

A custom variable with no value shows nothing

A template can use variables of your own, such as %{doc-type}. When a sheet uses that template, PropriΓ©tΓ©s du folio (Sheet properties) lists them in its PersonnalisΓ©es (Custom) tab with an empty value, ready to fill in.

Until you give one a value, the cell shows nothing. (Older builds printed the variable's own name, %doc-type, on the sheet until the sheet's properties had been opened and saved. Fixed by PR #989 and PR #1121.) Only the template's own text is blanked like this: a value you type that happens to contain a % is shown as typed.

To fill a custom variable on many sheets at once, use Chercher/remplacer (Search / Replace) and its Folio (Sheet) button: the PersonnalisΓ©es (Custom) tab of the window it opens lists every custom variable the sheets and their templates use. Fill only the ones to change; a variable left empty there is left unchanged on the sheets. See Search & Replace.

Full variable reference: Variables & formulas.


4. Logos

Logos are stored inside the template file, so a template is self-contained and can be shared as one file.

The <logo> tag is used for two different things, which is worth knowing before you hand-edit a file:

<logos>
    <!-- the stored image itself -->
    <logo storage="xml" type="svg" name="qelectrotech.svg">
        <svg …>…</svg>
    </logo>
</logos>
<grid cols="…" rows="…">
    <!-- a cell that displays one -->
    <logo row="0" col="0" rowspan="1" name="" resource="qelectrotech.svg"/>
</grid>

Inside <logos> it is the image; inside <grid> it is a cell, referring to an image by resource.

Two storage forms:

storage For How
xml SVG only the <svg> tree is embedded directly as XML
base64 any bitmap (and SVG, if you insist) the raw bytes, base64 encoded, as text

Bitmaps can only be stored as base64 β€” QET forces it regardless of what you ask for. SVG can use either, and xml is the sensible choice: it keeps the file diffable and lets the logo scale.

When you add a logo through the editor, QET tries SVG first and falls back to bitmap, so the storage form is chosen for you.

Known defect. A <logo> whose storage attribute is neither xml nor base64 loses its image data when the template is saved: the element is written with its attributes and no content, silently. The code contains the fallback that would prevent this but does not use it. Only hand-written or generated files can hit this β€” none of the shipped templates do. Keep storage to the two valid values.


5. Where templates live

Four collections, in QET's own vocabulary:

Collection Location For
Common titleblocks/ next to the binary the templates that ship with QET
Company <data dir>/titleblocks-company/ an organisation's shared templates
Custom <data dir>/titleblocks/ your own
Embedded inside the .qet file templates carried by a project

Embedded is the one that matters for sharing work: a project that uses a template you wrote carries a copy, so it renders correctly on a machine that has never seen your template.


6. The file format at a glance

<titleblocktemplate name="default">
    <information></information>
    <logos/>
    <grid cols="t22%;r100%;t22%;" rows="25;25;">
        <field row="0" col="0" name="author" align="left" valign="center"
               displaylabel="true" hadjust="true">
            <value><translation lang="en">%author</translation></value>
            <label><translation lang="en">Author</translation></label>
        </field>
        …
    </grid>
</titleblocktemplate>
Element Holds
<information> free text about the template β€” author, purpose
<logos> the stored images
<grid> cols, rows, and the cells
<field> a text cell
<logo> (in grid) a logo cell
<empty> an empty cell

The cell's tag name is its type: field, logo or empty. Common attributes are row, col, rowspan, colspan and name. A field adds align (left/center/right), valign, displaylabel, hadjust and fontsize β€” the last written only when a size has actually been set, so an absent fontsize means "default". A logo cell adds resource.


7. Practical notes

  • Design against the stretch, not a fixed width. Give the cells that must keep their proportions a t…% width and let one column take r100%. A template built from absolute widths only will look wrong on a different paper size.
  • Translate labels, not values. A value is usually a variable and the same in every language.
  • Use %{braced} variables so the editor can list them.
  • Keep a template self-contained. Logos live inside the file; do not rely on an external path.
  • A custom sheet field is enough to add a row. You do not need to modify QET to show project-specific information β€” add the field to the sheet and reference it as %{yourfield}.

See also: Variables & formulas Β· Auto-numbering Β· Project XML

Getting Started

Home

🌐 Languages β€” English Β· FranΓ§ais Β· Deutsch

Downloads

Windows without admin rights β€” the portable archive, no installer

Quick Start Guide

User Manual

FAQ

Tips & Tricks

Guides

Conductors β€” wire properties, what feeds which export, cables, and hops where wires cross

Wires per terminal β€” limit the wires on a terminal, chain wiring instead of stars

Printing and exporting β€” paper, PDF, images, and what each path does differently

Linking elements β€” master, slave, terminal

PLC modules β€” I/O tables and linking a wire to a specific point

Using the element editor β€” drawing tools, saving, checks

Grid size and element size β€” why symbols aren't all the same scale, and scaling one without leaving the grid

Preferences reference β€” what each settings page does

Saving and loading settings β€” your whole setup in one file, to copy or keep

Keyboard-only control β€” mouseless QET, and what still needs a mouse

Mouse modifiers β€” what Shift, Ctrl and Alt change while you drag

3D mouse β€” SpaceMouse pan, zoom and buttons

Aligning items β€” snap symbols back to the grid, or line them up

Pictures on a sheet β€” labels, crop, transparency, what they cost in the file

Arcs and curved wires β€” the Arc tool, pulling an arc in or out, rounding a corner with a fillet, dashed arcs for lighting layouts

Grouping items β€” select, move and copy several items as one

Finding your place on a sheet β€” go to a cell like B13 or 4-B7, keep the headers in sight, show the cell limits, zoom and pan

Showing and hiding kinds of items β€” hide texts, wire numbers, shapes, pictures, tables or cross-references on every sheet

Drawing faster β€” place without dragging, the S shortcut bar, command search, gestures

Customising QElectroTech β€” keys, toolbar size and contents, the gesture ring (partly pending)

Managing collections β€” folders, writability, building your own shortlist

Templates β€” reusable multi-element blocks, placed by double-click or drag

Search & Replace β€” bulk property changes

Building a nomenclature query β€” the BOM/summary table builder

Linking wires across pages β€” sheet reports

Variables & formulas β€” %f, %{label}, sequences

Auto-numbering β€” schemes, sequences, freezing

Terminal strips β€” strips, levels, bridges

Title block templates β€” the .titleblock format

Importing EPLAN parts (.edz) β€” EPLAN Data Portal

DXF import & export β€” two unrelated features, one format; command-line export and layers

The project database β€” the in-memory SQLite cache

File formats
Elements XML
Project XML
Development

Building from Source

Contributing Code

Automating QET β€” CLI, XML formats, external tools

CLI Reference β€” command line usage

JavaScript Scripting β€” --run, geometry editing, undo

MCP server β€” let an AI assistant read, verify and edit projects

Connecting an AI assistant β€” setup for Claude, Copilot, Gemini, Codex, Cursor, LM Studio

Script buttons β€” stored scripts with an icon, by hand or by an assistant

Live mode β€” an assistant working in the open project while you watch

Macro recorder β€” record a task by hand, for an assistant to script

Development Roadmap

Vision β€” proposal, under discussion

Developer Tools

About

Features

History

Community

License

Contributing to this Wiki

Clone this wiki locally