A project opened before the element collection panel's first load is
queued until the load starts; one opened during a load goes into the
model being loaded. ElementsCollectionWidget::removeProject() only
removed the project from the model already shown, so a project closed
in either window stayed in the collection, and the next reload read the
freed project (crash in XmlElementCollection::root()).
removeProject() now also takes the project out of the queue and out of
the model being loaded. That model waits for its loading threads, which
read the project, and drops the project's items from the list applied
when the loading ends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closing a modified project and choosing Discard left the project in the
project tree. The panel removed its item, but the project still emits
projectInformationsChanged() while it is torn down (setModified()), and
GenericPanel answered by adding the project back, with items for its
sheets. Once the project was freed, a click on one of those sheets
called diagram->showMe() on a freed Diagram: SIGSEGV in
QObjectPrivate::maybeSignalConnected(), the backtrace reported on the
forum (topic 3215).
The panel now stops listening to a project when it is closed, to its
sheets and to its embedded title block collection, before removing its
item.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A symbol built after opening (lazy folios) links to the partners its
link rows name, and to the symbols whose rows name it; its file's list
only adds what the rows miss. The rows keep a partner on a folio not
built until it is built, in its saved place, so a symbol no longer keeps
a list of its own: the list read from the file is dropped once opening
has filled the database. pendingLinks(), waitingLinks(),
keepsSavedLinks(), linksToSave() and QETProject::waitingLinkTargets()
go; the callers that asked a symbol for its waiting partners ask the
database (waitingPartners()).
When its links change, a symbol's rows are written from its built
partners and the waiting partners its rows held, in their order
(rowsToWrite()), so a full rewrite of the table keeps them too.
A symbol built alone as a partner on a folio not built
(Diagram::buildSymbols()) counts as built: its rows are kept, it is not
waiting (waitingSymbols(), waitingPartners()), so saving does not build
its folio, and removing it does not remove the rows naming it. A row
naming a placed symbol that has not linked yet (its folio being built)
is kept too. At opening the database holds no link until its fill
(forgetLinks()); the symbols read their files' lists until then, and the
fill takes their order: a symbol's own rows, its list, then the rows
naming it. The symbols waiting on folios not built are cached and
updated as folios are built.
QET_CHECK_LINK_ROWS now checks the rows against the links: each built
partner in its order, no other row but to a folio not built.
tst_resaveunchanged::undoKeepsLinksToUnbuiltFolios: m_000 opened with
lazy folios, a contact, its folio or its coil's folio (not built)
removed, then undone: every link saved as before.
QETZ-DB-FIRST stage 2a-3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a HiDPI screen QIcon::pixmap() returns each requested size at the
screen's ratio, so the sizes handed to the tray no longer matched
16 ... 256. Requested at 1.0, as ProjectFileGP in qeticons.cpp does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The folio title was put into the formula before %c, %l, %prefix, the
wire variables, the title block and project variables and the
sequences, so a title such as "Schema %c" had them replaced inside it.
It is replaced after all of them now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
inheritedProperties() cleared the text of a conductor held by a cable,
on the premise that CableManager writes the core label into it. It
writes it into m_cable only (Conductor::setCableReference()); the text
is the potential's real wire number. Clearing it lost a typed number on
the new wire and made distinctProperties() see a choice between ""
and the number where the potentials agreed. The text is now cleared only
when it repeats the core label.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The level spinbox of the terminal strip editor allowed stages up to 6
while the strip drawing handles at most 4 stages (0 to 3), so a stage
entered there was simply not drawn. Cap the spinbox at 3 and keep the
editor consistent with the drawing and the level columns.
Opening the terminal block manager builds the folios not built yet (lazy
folios). This is done in one go without running the event loop, so the
window system said the opening message was "not responding".
- QETProject::setFolioBuildObserver(): a function called after each folio
built by buildFolios(), with the number of folios built and to build.
- The manager uses it to show "Reading folio n of N..." with a real
progress bar, and runs the event loop (without the user input) between
two folios, so the window system keeps getting answers.
- The autosave skips its turn while folios are being built, since the
event loop can now run then.
- The opening message only has a title bar: nothing to minimize, maximize
or close.
One pass of the event loop after show() was not enough: the message box
was not painted yet when the long work started (seen on Wayland), only
the busy cursor was visible.
Wait for the window of the message to be exposed by the window system
(500 ms at most), then paint it before building the manager.
Opening the terminal block manager reads every terminal of the project,
and builds the folios not built yet (lazy folios): on a big project it can
take a while, and the user could think that nothing happens.
TerminalStripEditorWindow::instance(), used by the menu action and by a
double click on a terminal strip of a folio, now shows a busy message
("Opening the terminal block manager...") and a wait cursor while the
window is built or switched to another project. Moved from the header to
the .cpp file.
The redraw on change was connected in setTerminalStrip() only, used when
an item is read from the project. An item added with the "Add terminal
strip" dialog is built with TerminalStripItem(strip), which did not
connect: it was not redrawn after the terminal strip editor was applied,
until the project was reopened.
Both constructors now go through connectStrip().
A spare (reserved) terminal is a terminal of a strip which is drawn on no
folio. RealTerminal already foresaw it ("a terminal set by user but not
present on any folio") but every terminal needed an element.
- RealTerminal::createSpare(): a terminal without element, with its own
data (label, type, function, led, informations: section, width, catalog
terminal, color, manufacturer...). Saved in the strip:
<real_terminal spare_uuid="..." type="..." function="..."><informations>
Older versions ignore these terminals.
- TerminalStrip::insertSpareTerminals() / insertTerminals(): insert at a
position of the strip. Undoable commands AddSpareTerminalsCommand and
ChangeSpareTerminalDataCommand.
- Terminal strip editor: "Add spare terminals..." button. The terminals
are inserted after the selected terminal (at the end if none), numbered
from its label ("X1:12" -> "X1:13", "X1:14", leading zeros kept), with
its properties if asked. The labels can be changed or removed in the
table, like the other cells; the Xref column shows "Spare". Moving a
spare terminal to the independent terminals removes it (undoable).
- Nomenclature: the spare terminals are in the new spare_terminal table,
added to element_nomenclature_view (UNION ALL, same columns), after the
folios, in the order of their strip. exclude_from_bom is honoured.
- The modified cells of the editor model are kept by real terminal, not by
element, since a spare terminal has none.
TerminalStripItem was connected to nothing: after applying the terminal
strip editor (width, catalog terminal, color, type...), undo or redo, the
strip drawn on the folio kept its old drawing until something else made
the scene repaint, and its bounding rect was not updated when the width of
the terminals changed.
- TerminalStrip::dataChanged() is emitted when the data of the strip is
set, and when the data of the element of one of its terminals changes
(Element::setElementData(), Element::setElementInformations()).
- TerminalStripItem connects to dataChanged(), orderChanged(),
bridgeChanged() and bridgeColorChanged() of its strip, and updates its
geometry and redraws itself.
The glob "????-??-?? ??-??-??" contains the trigraph "??-", which GCC
reports with -Wtrigraphs (8 warnings). The pattern is now written with
"\?" escapes, in one place; it is the same string.
The realistic styles drew every terminal of a strip with the clamp of the
layout (RealisticScrew or RealisticPushIn), whatever terminal was chosen:
a Phoenix Contact ST (spring) was drawn with screws in a screw layout.
Each entry of the terminal catalog now has its clamp: screw (Phoenix
Contact UT, Weidmüller WDU, ABB Entrelec M, Legrand Viking 3), spring
(Phoenix Contact ST) or push-in (WAGO TOPJOB S). A terminal chosen in the
catalog is drawn with its own clamp, the spring-cage ones like the push-in
ones; the clamp of the layout is kept for the other terminals, so a strip
mixing screw and spring terminals is drawn as it is.
The manufacturer chosen to filter the terminals of the Width column is
stored in the data of the terminal strip (information "manufacturer" of
terminal_strip_data, written only when set), and selected again when the
strip is shown in the editor. Each strip keeps its own manufacturer.
Older versions ignore this information.
TerminalStripEditor::apply() now starts from the current data of the strip
instead of a new TerminalStripData: the uuid of the strip was replaced by
a new one at each apply, and the new information would have been lost.
Several terminals of the catalog have the same width (6.2 mm: Phoenix
Contact UT 4 and ST 4; 5.2 mm: WAGO 2002 and Phoenix Contact ST 2,5...).
Only the width was stored, so on reopening the first entry with that
width was shown instead of the terminal that was chosen.
- New element information terminal_catalog_entry: the label of the
terminal chosen in the catalog (e.g. "Phoenix Contact ST 4").
- Choosing a terminal also fills the manufacturer and manufacturer
reference informations (bill of materials, %{manufacturer_reference}),
only when they are empty or still hold what the previous catalog entry
wrote: a value typed by the user is never overwritten.
- Element editor: the manufacturer and the exact terminal are restored on
reopening. A width typed by hand, or stored before this change, stays a
plain width instead of taking the first terminal with the same width.
- Terminal strip editor: new "Manufacturer" combo filtering the terminals
proposed in the Width column (with the section filter); the column shows
"6,2 - Phoenix Contact ST 4", and copy/paste keeps the terminal.
Existing projects are unchanged: without the new information, only the
width is used, as before.
A symbol's <links_uuids> are now what the project database's link rows
list for it, in their order (projectDataBase::savedLinks()), instead of
a list the save built itself from the symbol's partners: QETZ-DB-FIRST
stage 2a, the save reads links from the database. A symbol the database
does not hold (saved outside a project) still lists them itself.
The rows leave out a partner the project no longer has, so removing a
folio with every folio built no longer saves links to its symbols, as
lazy folios already did (the links part of F113). Every other save is
unchanged.
tst_resaveunchanged removedFolioLeavesNoLinkToIt: affuteuse_250h with
every folio built, folio 3 removed: 4 links named symbols no longer in
the file, none now.
Needs #1522 (each symbol its own uuid) and #1523 (rows in saved order);
local only until both are merged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XCdg2Er2vYhB8Vwa5G7fSR
- tst_elementspanelprojectopen drives ElementsPanel::projectWasOpened() --
the slot the application connects to a project being opened -- on a fresh
panel whose first reload() has not run, reproducing the detached-item
ordering deterministically offscreen.
- On master without the guard the test fails: the auto-select leaves
currentItem() pointing at an item whose treeWidget() is not the panel (and
on some builds crashes in QTreeModel). With the guard it passes: no item is
selected while the project is detached.
- Registered via qet_add_app_test(), which links the application code and
runs a real QETApp offscreen.
Generated-by: Claude Code
Signed-off-by: hairykiwi <174199+hairykiwi@users.noreply.github.com>
- ElementsPanel::addProject auto-selects the first diagram via
setCurrentItem(qtwi_project->child(0)). When a project is opened before
the panel's first reload() has created its title-block collection items,
indexOfTopLevelItem(common_tbt_collection_item_) returns -1 and the
preceding insertChild() leaves qtwi_project detached from the tree model.
- The unguarded auto-select leaves a detached/invalid current item -- an
intermittent SIGSEGV in QTreeModel::index()/parent() on some builds; on
current master with Qt 6.11.2 the test shows the invalid selection without
a fault. Calling setCurrentItem() on an item the QTreeModel does not own is
unsafe; guard the auto-select with qtwi_project->treeWidget() so it runs
only when the item is attached.
- No behavioural change in the normal case: reload() re-adds the project
attached shortly after and performs the selection then.
- Pre-existing since a82f6de23 ("Add highlight current page in ProjectView").
Assisted-by: Claude Code
Signed-off-by: hairykiwi <174199+hairykiwi@users.noreply.github.com>
A project opened from a .qet was saved as a .qetz beside it, with a
notice, and the .qet left as it was: a project kept in git did not stay
a .qet. Save now writes the format the project was opened in; only Save
As changes it (scorpio810, discussion #1512). A .qetz is saved as a
.qetz as before.
The save-beside path goes: the flag set on opening, the .qetz path made
from the .qet's, write()'s switch to it and back on failure, and the
notice and replace question in ProjectView::doSave().
tst_resaveunchanged::qetSavedAsQetzBeside becomes qetSavedAsQet: Save of
an opened .qet writes no .qetz and the .qet holds what a plain save of
it holds (it fails without the fix: a .qetz is written beside).
tst_changedondisk makes its .qetz with Save As, as Save no longer does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qet_check reported -F1 as a duplicate master when one sits in +UV1 and one
in +UV2, although they are two devices: the place is part of the name, as
the %M/%LM label formulas show it and as IEC 81346 tools treat it. Group
the two duplicate-label checks by label and the effective place, the
element's own plant/location or else its folio's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_run_qet() kept only the last 400 000 characters of a run's output. A
large qet_edit (a whole multi-folio drawing in one call, some 2000 ops)
logs more than that, and the cut took the capability report the script
makes first: the tool then answered "the binary never ran the script"
although QElectroTech had run it and saved the result.
Lines the script reports through its marker are now kept whole wherever
they stand; only the other output is cut to the tail.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tray icon was QET::Icons::QETLogo, which comes from QElectroTech's
own icon theme bundled in its resources and so carries the theme name
"qet". On Linux Qt's StatusNotifierItem then sends only that name, and
the panel -- another process, without those resources -- cannot resolve
it: KDE Plasma showed an empty slot. Seen on D-Bus as IconName "qet"
and no IconPixmap.
The tray now gets an icon made of the logo's pixmaps only (16 to
256 px), which the tray sends as pixels. Checked on Plasma: IconName
is empty and IconPixmap carries the eight sizes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
checkContinuity() reported potential_mismatch on "cable" whenever the
conductors of one potential ran in different cables. A conductor held
by a cable carries its own core's label in the cable field (15W1:BN,
written by CableManager); a potential spread over several cables is the
normal case, e.g. a neutral fed from a terminal strip into each room.
On a house installation every N and PE potential was flagged.
Conductors held by a cable are left out of the cable comparison; the
free-text cable field of other conductors is still compared.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ST 1,5 (4.2 mm, 1.5 mm²), ST 2,5 and ST 2,5-QUATTRO (5.2 mm, 2.5 mm²)
and ST 4 (6.2 mm, 4 mm²), next to the UT screw terminals already listed.
Widths from the Phoenix Contact catalog and data sheets (ST 2,5-QUATTRO
3031306, ST 4 3037151, ST 1,5 3031076).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qet.addCable(folio, designation, type, coreColors, length, x1, y1, x2, y2)
does what the cable tool does after its dialog: a new cable whose trunk
is the line between the two points, every conductor the line crosses
taking the next core in order along the line, with the colour coreColors
lists at that place. One undo step, through AddCableCommand. An empty
designation takes the next free name. A conductor another cable already
holds is refused rather than taken away, since a script cannot be asked
the question the dialog asks. qet.cables() lists the project's cables.
The qet MCP server gains the add_cable op for qet_edit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A folio report whose text is a composite text replaced only %{label}
and the conductor variables. The report's own information is now
replaced as well, as on any other element, so a report can name the
device and terminal it leads to: "%{comment} %{label}" reads
"-XS27:N +UV1/2 UG Raum - 1.1" like EPLAN's interruption points.
Changing a report's information rebuilt such a text the way an ordinary
element's is built, turning %{label} into the report's stored label,
where its partner was when last saved. It now takes the same text
updateReportText() builds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A folio report could name the folio it points to by position (%f), folio
number (%F), installation (%M) and location (%LM), but not by its title.
EPLAN and other tools print references like "+UV1/1 Versorgung UG/EG.0",
which with %T is the formula "+%LM/%F %T.%c".
- FormulaContext carries the folio title, filled from the title block.
- %T is replaced on its own only, not as the start of a longer word.
- A report whose formula uses %T follows the target folio's title block
(BorderTitleBlock::informationChanged), as %F already follows its
folio number.
- The report and cross reference property pages list %T.
tst_reportfoliotitle checks the replacement, that %total and title
block variables keep their values, and an empty title.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>