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>
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>
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>
With "DXF : symboles en blocs" ticked in the export dialog, or
--dxf-blocks on the command line, each symbol definition a folio uses is
written once as a DXF block and every placed symbol as an INSERT of it.
A CAD program then selects, counts and replaces a symbol as one object.
The block is drawn by the same code as a symbol drawn in full, as if
the symbol sat unturned at the folio's origin, which is DXF (0,
sheetHeight): that is the block's base point, so the INSERT carries the
symbol's position and quarter-turn and nothing else. Blocks have to come
before any entity, so the export collects them first and dxfBegin()
writes them in its BLOCKS section. Entities in a block keep their own
layers. Off by default; with it off the file is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Circles and arcs: drawArcEllipse() split each curve into quarters and
fitted a circular ARC through a point half way between the curve and its
chord, so every circle came out as a flattened diamond. A circle or an
arc of one is now one exact CIRCLE or ARC. R10 has no ELLIPSE entity, so
a true ellipse is a polyline through the curve, one point every 5
degrees. The export also used a different scale on each axis, which made
round things oval; it now uses one, the largest that fits the sheet.
Title block at the right: the DXF laid the horizontal template out in
the narrow vertical strip, squashing it into the top corner. It is now
laid out horizontally and turned a quarter, as draw() turns the painter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anUnreadableSymbolIsNotACollision() takes every permission away from a
symbol file to check that an unreadable symbol is reported as such, not
as a collision. QFile::setPermissions() cannot do that on Windows, where
Qt only knows the read-only flag, so it returns false and the test
failed there. It now skips, as it already does when run as root, which
reads the file anyway.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
duplicatesAreNotNumberedWhenSwitchedOff turns two preferences off by
writing <home>/config/QElectroTech/QElectroTech.conf and pointing
XDG_CONFIG_HOME there. Only Linux reads settings from that file. macOS
keeps them in the system preferences, so the binary never saw the two
preferences, numbered the pasted duplicates anyway, and the test failed
on macOS, on master too.
Write the file where QET_SETTINGS_DIR points instead (#1178), and set that
variable for every run of the binary, so no run reads the user's own
settings either.
No file-format change. Tests: tst_elementautonumids fails on master on
macOS and passes with this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Beat Hangartner <beat@hangartners.ch>
layoutLines() trimmed the trailing spaces of every line and kept
non-breaking spaces, which the DXF export used to write as plain spaces
(toPlainText()). A DXF R10 file has no code page, so a reader assuming
Windows-1252 could show them as 'Â '. Now a paragraph that does not
wrap gives exactly its line of toPlainText().split('\n') again
(trailing spaces and tabs kept, non-breaking spaces as plain spaces,
<br> as a line break). In a paragraph that wraps, every line loses its
trailing spaces, so spaces that wrap to a line of their own give an
empty line: not written, but it keeps the spacing of the next lines.
Test: tst_textlines compares with toPlainText() for trailing spaces,
tabs, non-breaking spaces, <br> and paragraphs, and checks wrapped
lines (fails before).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- setTextWidth() returns without a signal when the width does not
change, which is also the case on every load of a text without one.
- Say why IndependentTextItem::textWidth()/setTextWidth() hide the
non-virtual QGraphicsTextItem functions, and what that means for code
holding a base pointer.
- The fixture no longer carries a /tmp path from the machine it was
made on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The independent_text table had the text and rotation of a free text but
not its width, and a width change did not update the row at all -- not
even its width and height, which follow the wrapped text. Add a
text_width column (NULL for the automatic width) and update the row on
textWidthChanged.
Test: tst_scriptfreetextwidth reads the table with qet.query() (fails
before).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A scene drops the event filters of an item that leaves it. The handles
installed theirs once, in the constructor, and only if the text was in
a scene: after the text was removed and added back (undoing a delete
does that), or when the handles were made before the text was in a
scene, they no longer reacted, and a drag moved the text instead.
TextResizeHandles now installs the filters again whenever it enters a
scene.
Tests: dragAfterLeavingTheScene, dragWhenCreatedOutsideAScene (both
fail before).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Shortcuts page now shows:
- each command's icon, and a Menu column saying where it is
("Projet › Scripts"); the text filter matches that too
- a category filter beside the existing Bound/Unbound/Conflicts one
- "Rechercher par touche": press a key combination and only the
commands using it are listed, however the key is spelled in the
user's language. A key also finds the two-key shortcuts it starts.
- "Copier la liste": the shown rows go on the clipboard as
tab-separated text with a header, so they paste into a spreadsheet
one cell per column
ShortcutManager::ShortcutInfo carries the icon and the first live
QAction so the page needs no second registry.
New test tst_shortcutspage covers the menu path, the columns, both
filters and the copied text.
Second stage of discussion #1319.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A symbol text with a width (text_width) is drawn wrapped on the folio,
but the DXF export split texts on '\n' only, so it was written as one
long line, running past its box and over the drawing. The export now
writes the lines of folio texts as they are laid out
(TextLines::layoutLines(), new header-only textlines.h). Texts without
a width give the same lines as before.
Tests: tst_textlines, tst_dxfwrappedtext (fails without this change).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TextResizeHandles puts four handles at the corners of a selected text
(any QGraphicsTextItem with a qreal "textWidth" property, -1 = automatic
width). Dragging one changes the width: the opposite corner stays in
place in scene coordinates, for any rotation and rotation point, the
text wraps and the height follows it. Vertical mouse movements are
ignored, the width never goes below the longest word and is rounded to
whole pixels, and a click without a move changes nothing.
Double-clicking a handle goes back to the automatic width.
The handles are a child of the text, so they follow it when it moves,
rotates or is zoomed (as for the symbol text handles, #1002). The width
is changed live; the owner makes it undoable with TextResizeCommand,
which sets the width then the position on both undo and redo -- a text
may move itself when its width changes, so two property commands would
restore them in the wrong order.
The geometry is header-only (textresize.h). Nothing uses the handles
yet: the follow-up changes add them to free texts and to text fields in
the element editor.
Test: tst_textresizehandles, on a plain QGraphicsTextItem.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A free text (IndependentTextItem) gets a textWidth property: -1 is the
automatic width (one line, or lines broken by hand, as today); a
positive width makes the text wrap between words. Its top-left corner
stays in place. The property is what a spin box and resize handles will
set in follow-up changes.
File format: the width is saved as text_width on <input>, only when one
is set, so a project without widths is saved byte-identical
(tst_resaveunchanged). An older QElectroTech ignores the attribute and
shows the text on one line, with no load error.
DiagramTextItem::setHtml() no longer widens a centred or right-aligned
rich text to idealWidth() + 40 when the text has a width of its own;
with the automatic width it still does.
Test: tst_freetextwidth (--resave keeps the width only where set,
--export-svg draws the text wrapped).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- replaceImage(), mirror() and setTransparentColor() no longer add a
dummy QUndoCommand child: the imageSource child already keeps
QPropertyUndoCommand::mergeWith() from merging two of them.
- The explanation of the position and pivot maths moves from crop() to
applyCrop(), where that code now lives; the stale older doc block of
crop() goes.
- applyCrop() returns false when nothing was cropped, and
qet.cropImage() passes that on. tst_imagecropundo checks it for the
current crop, an empty rectangle and one outside the picture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since #849 the parts list has a row for every contact block (slave) and
terminal-type element. Users who draw the dots and bends where wires
branch as terminal-type symbols (114_connections) get one empty row per
junction: 109 of 151 rows on one reported cabinet.
Two options, both off by default so existing exports are unchanged:
- leave out the contact blocks: --no-slaves, "no_slaves" in qet_export,
or uncheck the new "Contacts esclaves" element type in the dialog;
- leave out the junctions: terminal-type elements with no label,
designation, manufacturer or manufacturer reference. --no-junctions,
"no_junctions", or "Laisser de côté les jonctions" in the dialog.
A terminal block with a label or a part number stays.
The element type filter had no box for slaves, so every query it built
left them out: the export dialog never listed contact blocks, although
the command line has since #849. The dialog now checks the new box by
default and gives the same rows as --export-bom. The box is unchecked by
default elsewhere, so nomenclature tables keep their rows.
docs/smart-device-bom.md still said slaves and terminals were excluded;
corrected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rewriting the links copied the old trailer up to %%EOF, so the old
startxref stayed in the file before the new one. Its offset is the size
the file had before the rewrite, and the links carry the output path,
so the same project exported to two folders gave different bytes, and
a different document id. Both rewrites now copy the trailer dictionary
only, through one helper; the print window's rewrite no longer leaves a
stray %%EOF either.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Crop a picture as the crop tool does, in one undo step, and read its
crop rectangle back. tst_imagecropundo uses them on the real binary:
a crop that was undone is not saved, and redoing it saves it again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each folder now holds icons from one source: qet/ for QET's own SVGs,
breeze/ for KDE Breeze (with breeze/added/), flags/, colors/, and
themes/ for script output (with themes/generated/). The unused
128x128/terminalstrip.svg is removed. The generator, qrc files,
qeticons.cpp and ico/copyright follow the new paths. ico/README.md
lists each folder's source, script and license.
Part of #1269.
A conductor draws a junction dot at each of its bends that lies on
another conductor. It only looked at the conductors on its own two
terminals, so a bend lying on a conductor of the same potential that
shares no terminal with it got no dot. Dragging the horizontal parts of
a chain of conductors onto one line, as in the report, does exactly that.
Look at every conductor of the potential on the folio instead
(relatedPotentialConductors(false)). The folio scene uses NoIndex, so a
scene lookup at each bend scans every item and made export of the
366-conductor Polonez example 60% slower; walking the potential costs
nothing measurable there (2.08 s vs 2.11 s) or on a 153-conductor
potential (0.97 s both).
The test for one other conductor moves into bendMakesJunction(). It
also stops a point being appended once per matching segment: master drew
the dot above K2 in the fixture ten times.
Across the 23 examples (133 folios) exported to SVG, 6 dots are added,
all at T-joints that had none, and none removed.
tst_junctiondots exports fixtures/junction_dot_shared_potential.qet and
checks for both dots; it fails on master with the dot above K3 missing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With SOURCE_DATE_EPOCH set, the document id came from the project's uuid
and a hash of the .qet file. A project generated again from the same
data has new uuids, so its PDF differed in the id alone (XMP DocumentID
and trailer /ID, 120 bytes) although every page was the same.
Qt now writes a fixed placeholder id, and once the file is written the
placeholder is replaced with an id derived from the bytes of the PDF:
the same pages give the same id. Same length, so no offset changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test set the elements folder in a settings file under XDG_CONFIG_HOME,
which macOS does not read, so common:// paths did not resolve and the
first placement failed. It now passes --common-elements-dir.
Schemas now get saved with a UUID and do not have to be looked up according to the form. They can be renamed and it gets reflected in existing elements. The GUI for
editing them is now much easier, e.g. forms can be reshuffled. A formula can be applied. Many options now also for conductors and sheets.
Review of #1272: scorpio810 asked for a warning box for users; the inline
box added in 9a55939bb is replaced by a pop-up, as the element editor
gives for unnamed terminals. When OK in Settings > General or in Project
properties turns a rule on (a limit where there was none, or one wire
per folio report), a warning says the rules are experimental, may change
with settings to redo if wires and conductors become separate objects,
and can all be turned off in Settings > General. OK goes on. Changing a
limit that was already on, or turning rules off, shows nothing.
tst_wiringrules: when the warning is due (WiringRules::turnsRuleOn()).
Checked in the GUI from both pages, and that a plain OK shows nothing.
English for translators: "Warning"; "The wires-per-terminal rules are an
experimental feature. They count wires as QElectroTech represents them
today. They could change, and your settings need redoing, if wires and
conductors become separate objects in a future version. All these rules
can be turned off in Configure QElectroTech > General."
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FPuYPS4T7QuEwjNu22rXD