Commit Graph

10261 Commits

Author SHA1 Message Date
Beat Hangartner afa35e094d Undo restores whether a picture's pivot was placed by hand
A picture remembers whether its pivot was placed by hand: a hand-placed
pivot is saved and kept through a resize, a default one is not saved
and recentres after a resize. Two actions changed that flag outside
their undo step:

- applyCrop() marked the pivot as default after moving it to the centre
  of the kept region. After Ctrl+Z the pivot was back where the user
  had put it, but marked as default, so the next save dropped it.
- dragging the pivot handle marked it as hand-placed. After Ctrl+Z the
  pivot was back at the centre but still marked as hand-placed, so a
  later resize left it at the handle's anchor corner.

pivotIsCustom becomes a property, and both actions put it into their
undo command next to rawPivot. tst_imagecropundo checks that a project
saved after undoing a crop keeps its hand-placed pivot.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 10:54:53 +02:00
ispyisail 140f9f6e39 Merge pull request #1355 from ispyisail/feat/upright-symbol-texts
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 1m54s
Add an option to keep texts of turned symbols horizontal
2026-10-07 21:39:49 +13:00
ispyisail fd0df50c17 Merge pull request #1354 from ispyisail/feat/1335-flip-elements
Add horizontal and vertical mirror for symbols on a folio (#1335)
2026-10-07 21:30:18 +13:00
ispyisail aac004bcdd Merge pull request #1368 from bhangart/refactor/image-pixmap-from-source
Compute a picture's displayed pixmap from its source
2026-10-07 21:24:39 +13:00
ispyisail c8944e23b2 Merge pull request #1370 from ispyisail/fix/qt-colour-dialog
Fix saved custom colours being pushed out on Linux
2026-10-07 21:23:10 +13:00
ispyisail 5d2eddfdd1 Merge pull request #1358 from bhangart/fix/bordertitleblock-uninit-members
Initialise the BorderTitleBlock members its constructor compares
2026-10-07 21:18:30 +13:00
ispyisail 3662032289 Merge feat/1335-flip-elements into feat/upright-symbol-texts
Brings in master's DXF blocks (#1339) through #1354. The upright texts
now live in drawSymbol() too, and a turned symbol whose texts stay
horizontal is drawn in full like a mirrored one: an INSERT would turn
its texts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 21:17:38 +13:00
ispyisail d508e0adb2 Merge pull request #1359 from bhangart/fix/conductorprofile-uninit-orientation
Initialise the orientations of a default-constructed ConductorProfile
2026-10-07 21:14:36 +13:00
ispyisail f94ad83c46 Merge pull request #1366 from ispyisail/translation/english-update
Update the English translation (qet_en.ts)
2026-10-07 21:12:46 +13:00
ispyisail a55c1312de Merge pull request #1357 from ispyisail/fix/aligned-text-lines-auto-width
Fix line alignment of multi-line symbol texts with Auto width (#1348)
2026-10-07 21:12:20 +13:00
ispyisail 14a31e895e Merge master into feat/1335-flip-elements
Conflicts with the DXF blocks export (#1350) and the picture factory
leak fix. The mirror now lives in drawSymbol(); a mirrored symbol is
drawn in full rather than as an INSERT of its block, since a negative
INSERT scale would mirror its texts too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 21:11:00 +13:00
ispyisail b1f1f77a53 Merge pull request #1365 from ispyisail/feature/customise-dialog
Add a Customise window for toolbars, shortcuts and gestures
2026-10-07 20:57:15 +13:00
ispyisail bae96b4ae7 Merge pull request #1364 from ispyisail/feature/customise-gesture-list
Add a mouse gesture page: own commands, 4 or 8 directions
2026-10-07 20:56:50 +13:00
ispyisail a43ce3baa5 Merge pull request #1362 from ispyisail/feature/folio-paper-size
Add paper sizes A0–A5 to the folio dimensions
2026-10-07 20:54:31 +13:00
ispyisail 72b215bb23 Always use Qt's own colour dialog
On GTK desktops (Mint, XFCE, GNOME) Qt hands QColorDialog to GTK's
chooser. Its "Custom" row is a recent-colours list kept by GTK: every
colour picked is pushed in on the left and the oldest drops out, so a
user's saved wire colours are lost (forum topic 3190). It also ignores
the custom colours QET saves (#918) and has no swatch grid for the
double-click to accept (#1172).

Pass DontUseNativeDialog at every colour dialog, so all platforms get
the dialog Windows already shows: 16 custom slots that change only on
"Add to Custom Colors", saved across restarts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 20:53:11 +13:00
ispyisail a3c178e4ce Update the English translation (qet_en.ts)
lupdate over sources/ finds 98 new source texts. 41 are new and are
translated here: the Toolbars settings page, the new Shortcuts page
controls (category filter, search by key, Menu column, copy list), the
Edit > Selection submenu, DXF block export options, cross-reference
stacking, picture dark-theme adaptation and text width.

The other 57 were already translated but marked vanished by the
4 October translations update (da39ec1c8), so lrelease left them out
and these screens showed French in the English interface: the 3D mouse
settings page, the table properties editor and the text field
properties. They come back with their existing English.

lrelease: 3737 finished, 0 unfinished.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 20:08:38 +13:00
ispyisail 0fef6b19ce Add a Customise window: toolbars, shortcut bar, keyboard, gestures
Configuration > Personnaliser... (also at the bottom of a toolbar's
right-click menu) opens one window with a tab for each page that sets
how the user works: Barres d'outils, Contenu des barres, Barre de
raccourcis, Raccourcis and Gestes de la souris, like SolidWorks'
Tools > Customize. The tabs are the same pages the configuration
dialog shows, which keeps them. OK applies every tab, Cancel none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 19:31:42 +13:00
ispyisail b6bbcfdd7a Merge branch 'feature/customise-gesture-list' into feature/customise-dialog
# Conflicts:
#	tests/qttest/CMakeLists.txt
2026-10-07 18:41:40 +13:00
ispyisail 46e041fe01 Mouse gestures: own command list, 4 or 8 directions
The right-drag ring showed the shortcut bar's commands for the selection.
A new Preferences page, "Gestes de la souris", lets the user pick the
ring's commands per selection context, one per direction, and choose 4 or
8 directions. Commands are dropped from the list onto a slot of a ring
editor, or placed with a button; Delete empties a slot.

A context the user never edits keeps following the shortcut bar, and 8
directions stays the default, so nothing changes for anyone who does not
open the page. A picked list is positional: a direction left empty, or
holding a command this build lacks, stays empty instead of shifting the
others. Stored like ShortcutBarSettings: diagrameditor/gestures/<context>
id lists in QSettings, defaults not stored.

tst_gesturesettings covers the defaults, positional lists, the 4/8
setting, the overlay's sectors and empty slots, and the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 18:38:25 +13:00
ispyisail 3a61513f29 Let the user choose what each folio editor toolbar holds
Configure QElectroTech > Toolbar contents: pick a toolbar, drag or add
commands from the list on the left, remove them with Delete, reorder,
add separators, and add, rename or delete toolbars of one's own.
Reset to defaults gives a toolbar its original contents back.

Each toolbar is stored as a list of command ids in QSettings
(diagrameditor/toolbars/<objectName>), the same pattern the shortcut
bar uses. A toolbar the user never changed stores nothing and is built
exactly as before; an id no command carries any more is skipped. The
four buttons that are widgets rather than commands (handle size, text
grid, background colour, conductor colour) get ids of their own and
can each be on one toolbar at a time. Stored scripts can go on any
toolbar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 18:34:51 +13:00
ispyisail 5f21d4fce2 Paper size presets: never fit fewer than 3 columns or rows
fitCells() tried counts from 1, but BorderTitleBlock raises any column
or row count below 3 to 3. With very large cells (A5 portrait with
columns of about 200 px or more) the preset picked 2 columns; the folio
then got 3, came out wider than the sheet, and the dropdown fell back
to "Custom". Start the search, and the capped fallback, at 3, and
refuse a paper that leaves no room for 3 cells of the smallest size.

A5 portrait with 300 px columns now gives 3 x 179 px instead of
2 x 269 px; A4 landscape with the default cells is unchanged
(19 x 58 px). ctest 65/65.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 18:07:03 +13:00
Laurent Trinques 437729df15 Merge pull request #1327 from ispyisail/feature/customise-toolbar-options
Add a Toolbars settings page: icon size, text with icons, lock
2026-10-07 06:50:11 +02:00
Laurent Trinques 0b993f4d89 Merge pull request #1344 from bhangart/fix/headless-log-to-stderr
Write the messages of a headless run to stderr on Windows too
2026-10-07 06:47:33 +02:00
Laurent Trinques 5106dd3029 Merge pull request #1360 from bhangart/fix/elementpicturefactory-text-leak
Delete the text items ElementPictureFactory::build() creates and drops
2026-10-07 06:45:38 +02:00
Laurent Trinques e107c9444f Merge pull request #1356 from ispyisail/fix/composite-text-variable-insert
Fix composite text dialog not inserting variables (#1348)
2026-10-07 06:42:54 +02:00
Laurent Trinques a79eaf8af6 Merge pull request #1345 from bhangart/fix/unreadable-element-test-windows
Skip tst_unreadableelement where a file cannot be made unreadable
2026-10-07 06:41:12 +02:00
Laurent Trinques 223ace3a40 Merge pull request #1347 from saschbe/fix/background-color-menu-title
fix: name the sheet background color submenu
2026-10-07 06:39:00 +02:00
Laurent Trinques 5c38907204 Merge pull request #1346 from ispyisail/fix/1336-edit-menu-submenus
Fix #1336: split the long Edit menu into submenus
2026-10-07 06:38:22 +02:00
Laurent Trinques 211075f1b3 Merge pull request #1343 from bhangart/feature/element-editor-text-field-handles
Resize text fields in the element editor by dragging a corner
2026-10-07 06:36:48 +02:00
ispyisail 2752e6705c Folio properties: paper size presets A0-A5, landscape or portrait
A "Format" choice in the folio dimensions box sets the columns and rows
so the whole folio, title block included, has the size of an ISO A
sheet at the 96 dpi the PDF export uses. A4 landscape keeps 60 px
columns and 80 px rows and comes out as an A4 page in the PDF.

Nothing new is stored: the choice only fills in the columns and rows.
A folio whose size already matches a paper shows that paper; any other
shows "Custom". Changing the title block template after picking a paper
fits the folio again; a template too tall for the paper falls back to
"Custom".

The same box is in Folio properties and in the new-folio defaults of
the project and application settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 17:36:22 +13:00
Laurent Trinques e2fd2d1c20 Merge pull request #1342 from bhangart/feature/free-text-resize-handles
Resize free texts by dragging a corner
2026-10-07 06:36:06 +02:00
Laurent Trinques 96fc0b9d4a Merge pull request #1341 from bhangart/feature/free-text-width-spinbox
Set the width of free texts in their properties
2026-10-07 06:35:17 +02:00
Laurent Trinques 60237d7070 Merge pull request #1353 from ispyisail/feat/dxf-block-data
Add symbol part data to DXF blocks as hidden attributes (#1339)
2026-10-07 06:34:16 +02:00
Laurent Trinques 9396a367db Merge pull request #1352 from ispyisail/feat/dxf-block-labels
Add an option to export symbol texts as DXF block attributes (#1339)
2026-10-07 06:33:37 +02:00
Laurent Trinques 7e9b479a57 Merge pull request #1351 from ispyisail/feat/dxf-symbol-blocks
Add an option to export symbols as DXF blocks (#1339)
2026-10-07 06:32:51 +02:00
Laurent Trinques 3d5100789b Merge pull request #1350 from ispyisail/fix/1339-dxf
Fix DXF export of circles, arcs and right-side title blocks (#1339)
2026-10-07 06:31:57 +02:00
Laurent Trinques 36d0b06f0f Merge pull request #1349 from saschbe/fix/image-dark-colours
Preserve imported image colours by default in dark mode
2026-10-07 06:29:32 +02:00
Beat Hangartner 1b0ab6d26a Compute a picture's displayed pixmap from its source
The displayed pixmap and imageSource (original, crop rectangle,
transparent colours) were two undo values that had to change together,
although the pixmap follows from the source. An action that updated
one and not the other would bring back the bug fixed in #1310.

setImageSource() now recomputes the displayed pixmap, and crop, colour
key, mirror and replace push one undo step on imageSource alone. A
plain QUndoCommand holds the property change, so two identical actions
in a row stay two steps. Loading a project still shows the saved pixmap
as before.

tst_imagecropundo also checks the size of the saved picture after undo
and after redo.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 06:25:14 +02:00
ispyisail 36df4b3010 Centre or right-align the lines of symbol texts with an automatic width (#1348)
A symbol text on a folio with its width on "Auto" kept every line of a
multi-line text on the left, whatever its alignment: a QTextDocument
with no text width has no width to centre or right-align lines in. It
only worked once the user gave the text a width wide enough.

With the width on Auto and a centre or right alignment, give the
document the width of its longest line. The size of the text does not
change, only where the shorter lines sit. The fit is redone when the
text, the alignment, the width or the font changes; on a font change
the text's anchor is kept, as the font change itself does.

textWidth() now returns the width the user set (-1 for Auto), the value
that is saved, rather than the document's, as IndependentTextItem
already does. Readers (properties panel, resize-handle undo, script
API, project database) see -1 for Auto as before.

Checked: every folio of the 25 example projects renders identically to
master (136 PNGs); a centred and a right-aligned two-line text now
render aligned; changing their font size leaves the same box and anchor
as master, and without the font-change refit the lines wrap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 13:12:22 +13:00
Beat Hangartner e50e6a492e Put stdout of a headless run into binary mode on Windows too
stderr got it in the previous commit; stdout (the JSON of --info, the
messages of the exports) still ended its lines in "\r\n" on Windows
while stderr ended them in "\n". Both streams now give the same bytes
on every system.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 01:51:00 +02:00
Beat Hangartner 1fdb0ee32e Skip tst_unreadableelement on Windows only
The skip applied wherever setPermissions() failed, which on Linux and
macOS would hide a real failure. Only Windows cannot take read
permission away; elsewhere the call must succeed as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 01:51:00 +02:00
Beat Hangartner 9882a79a93 Refresh the free text handles when the text comes back to a folio
itemChange() removed the corner handles when the text left the scene
but did not bring them back when it returned still selected, which Qt
allows (undoing a scripted delete does it) without a selection change.
Refresh on every scene change. The two handle helpers are protected:
nothing outside the class calls them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 01:51:00 +02:00
Beat Hangartner 2c9900eca8 Make 0 the automatic width in the free text width box
The box showed Auto for -1 while IndependentTextItem::setTextWidth()
treats every value up to 0 as automatic. Typing 0, or the first click
on the up arrow from Auto, then put a width change in the undo history
that changed nothing, left the box on 0, and in live edit every later
change of X, Y, angle, text or size was replaced by that empty command.
Auto is 0 in the box now, like in the setter: no number is the automatic
width, and the first step up is 1 px.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 01:51:00 +02:00
Beat Hangartner 2e4982e871 Drop a check that cannot trigger in the element editor
A dynamic text field is never edited inline in the element editor (it
never sets text interaction flags), so the handles never had to hide
for it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 01:50:05 +02:00
ispyisail b9d459b0e6 Fix composite text dialog not inserting variables under Qt 6 (#1348)
The slot was auto-connected by name to QComboBox::activated(QString),
which Qt 6 removed, so connectSlotsByName() found no signal and picking
a variable in the "Texte composé" dialog did nothing. activated(int)
exists in Qt 5 and Qt 6; the slot never used its argument and reads
currentData() as before.

Same fix as the CompositeTextEditDialog half of #674, which was closed
unmerged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:49:37 +13:00
ispyisail 592cbdbf0b Keep the texts of turned symbols horizontal, per project (#1335)
A project can now keep the texts drawn in its symbols, and the names of
their terminals, horizontal when a symbol is turned: Project properties >
General, "Garder horizontaux les textes des symboles pivotés". The box of
each text turns with the symbol; the text does not, and reads as it does
in the symbol itself.

It is a project setting, saved as <symbol_texts upright="true"/> and
only when on. A new project starts with it on; a project saved without
it (every existing one) reads with it off, so it looks and saves exactly
as before, and looks the same on every computer. The MCP server's new
projects start with it on too.

It builds on the mirror of #1354, which already redraws the texts of a
mirrored symbol readable: what the symbol does to its texts is now its
mirrors and, with the setting on, its turn (Element::symbolTextsTransform()).
ElementPictureFactory caches one drawing per such transform, terminal
names undo it the same way, and the DXF export places the texts alike.

The fields of a symbol (label, comment...) already keep their angle with
"Garder la rotation visuelle" and are left as they are.

Known limit: two texts stacked in a symbol end up side by side when it is
turned, and can overlap when kept horizontal; the setting can be turned
off for such a project.

Test: tst_uprightsymboltexts turns the symbols of a folio and checks the
angle of each motor's "M" in the DXF, with the setting off and on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:43:04 +13:00
ispyisail a3b1468b0f Mirror: terminal names, reload drawings, turned text groups, a leak
Found by review of #1354:
- Terminal names (shown on the folio) read backwards on a mirrored
  symbol: Terminal::paint() now mirrors them back about the centre of
  their box, in the frame they are drawn in.
- "Reload the drawings of the symbols" left mirrored symbols with the old
  drawing: reloadPicture() refreshes the mirrored pictures too.
- Turning a group of texts on a mirrored symbol left the group's
  readable mirror about the centre of its old box until the next layout:
  ElementTextItemGroup::setRotation() reapplies it, as texts already do.
- The mirrored build of a symbol's drawing leaked the texts of its
  primitives, which only the drawing without mirror keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:13:27 +13:00
ispyisail a5b5d49b98 Add horizontal and vertical mirror for symbols on a folio (#1335)
Edit > "Miroir horizontal" (M) and "Miroir vertical" (F), also in the
folio's right-click menu, mirror the selected symbols in place. The keys
are the ones the element editor uses for the same two actions.

An element keeps two mirrors about its own axes, applied before its
rotation, and saves them as mirror="horizontal|vertical|both" on its
<element> (written only when set, so other projects save byte for byte
as before). On a symbol turned by 90 or 270 degrees, a mirror of the
folio is the other mirror of the symbol itself, so the rotation never
changes: a label kept upright does not swing round, and "Pivoter" still
turns a mirrored symbol clockwise.

- Terminals face the mirrored way (Terminal::orientation()), so wires
  follow.
- The symbol stays where it was: its centre is kept, on the grid, since
  the hotspot is often a corner.
- Texts read normally. The element's texts, text groups and cross
  reference are mirrored a second time about the centre of their own box
  (Element::keepReadable()), and ElementPictureFactory draws the texts
  of the symbol itself the same way, in a cached picture per mirror.
  Groups and cross references held at the bottom of the folio stay
  centred under their element.
- DXF export mirrors the symbol's lines, arcs and texts.
- Scripting: qet.mirrorElement(folio, uuid, vertical) and
  qet.elementMirror(folio, uuid); live mode may run both menu commands;
  the MCP server gets a mirror_element op and qet_diff reports mirrors.

Not done: the parts of a PLC table drawn at run time
(Element::drawPlcTable()) are not kept readable on a mirrored PLC; the
project database has no column for it, as it has none for the rotation.

Test: tst_scriptmirror mirrors a symbol through --run, checks every
terminal's side and facing, the round trip, undo, a save and reload,
and a symbol turned by 90 degrees.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:05:17 +13:00
ispyisail aa6abe6e81 Export a symbol's part data as hidden attributes of its DXF block (#1339)
With symbols as blocks, every non-empty information field of a symbol
(label, manufacturer, reference, supplier, quantity...) is written as a
hidden attribute of its INSERT, tagged with the field's name. A CAD
program can then list the parts from the drawing, as with AutoCAD's
attribute extraction; hidden, they change nothing on screen, in any
reader. A field already written as a visible attribute (with
--dxf-attributes) is not repeated. The label formula is left out: it is
how the label is made, not part data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 10:14:13 +13:00
ispyisail 9699b314b0 Add an option to export a symbol's texts as DXF block attributes (#1339)
With symbols as blocks and the new "DXF : textes des symboles en
attributs" option (--dxf-attributes on the command line), a symbol's own
texts (its label, function, comment...) are attributes of its INSERT
instead of loose texts, so a CAD program moves them with the symbol and
can list or edit them. Each is written exactly where, and as, the text
was. A text showing an information field is tagged with its name
(LABEL, FUNCTION...), a typed text TEXT1, TEXT2...; a text's second line
gets _2. The block defines each tag once, placed where the first symbol
has it.

Its own option, off by default, because LibreCAD (2.2.1.5) does not
show attributes: the labels would vanish there. AutoCAD shows them.

The text geometry moves into textLines(), shared with the text loop,
so the attributes and the plain texts cannot drift apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 10:12:20 +13:00