Commit Graph

3517 Commits

Author SHA1 Message Date
Laurent Trinques 7d718bb9a0 crossrefitem: fix terminal name sorting for power contacts
The previous sort used QString::toInt() to order terminal names,
which returns 0 for any string containing a non-numeric prefix
(e.g. "R1", "R2", "L1", "L2"...). This caused undefined sort order
and incorrect pole pairing in the Xref contact mirror.

Example: a 4-pole NC power contact with terminals R1..R8 was
displaying R1/R3, R5/R7, R2/R4, R6/R8 instead of the correct
R1/R2, R3/R4, R5/R6, R7/R8.

Fix: extract the trailing numeric part of each terminal name and
compare prefixes separately. If both names share the same prefix
and both have a trailing number, sort numerically on that number;
otherwise fall back to full string comparison.

This covers all naming conventions: "1"/"2"/"3", "R1"/"R2"/"R3",
"L1"/"L2"/"L3", etc.

Applied in both drawContact() and setUpCrossBoundingRect().
2026-05-23 15:50:11 +02:00
Laurent Trinques d949e6eb8c crossrefitem: fix SIGSEGV when dropping power NC contact on diagram
Three bugs were causing a crash (SIGSEGV in QRegion::begin) when
a power NC slave element was placed on a folio, even before linking
it to a master element.

1. m_drawing (QPicture) was never reset between updateLabel() calls.
   QPicture accumulates paint commands — calling qp.begin() on an
   existing QPicture appends to it rather than replacing its content.
   After several updates (load, move, hover...) the picture became
   corrupted and crashed on play().
   Fix: reset m_drawing = QPicture() at the start of updateLabel().

2. m_drawed_contacts was only initialized to 0 in drawAsContacts(),
   but not in drawAsCross(). When drawing in Cross mode, fillCrossRef()
   called drawContact() with an uninitialized m_drawed_contacts value,
   producing a garbage offset. The NC contact symbol uses drawPolyline()
   with a sub-pixel Y coordinate (offset+2.5); with a random offset Qt
   generated an invalid QRegion and crashed.
   This explains why NC contacts crashed but NO contacts did not: the
   NO symbol only uses drawLine() which is more tolerant of bad coords.
   Fix: add m_drawed_contacts = 0 at the start of drawAsCross().

3. setUpCrossBoundingRect() used QRectF() (null rect) as the reference
   rect for painter.boundingRect(), which can return invalid dimensions.
   Additionally, height was accumulated incorrectly: united() + setHeight()
   doubled the height at each iteration, causing an exponentially growing
   bounding rect with multiple contacts.
   Fix: use QRectF(0, 0, 500, 20) as reference rect and accumulate
   height and width independently.
2026-05-23 15:32:28 +02:00
Laurent Trinques dbda958261 terminaldata: add No, Nc, Common types for SW contacts
Extend TerminalData::Type enum with three new semantic values:
- No     : Normally Open terminal of a switch (SW) contact
- Nc     : Normally Closed terminal of a switch (SW) contact
- Common : Common terminal of a switch (SW) contact

Update typeToString() and typeFromString() accordingly.
Fully backward compatible: existing Generic/Inner/Outer types
are unchanged. Elements without typed terminals fall back
to the previous behavior (first 2 named terminals).

terminal: expose terminalType() as public accessor

Add Terminal::terminalType() returning the TerminalData::Type
of this terminal. This allows crossrefitem and other consumers
to filter terminals by semantic role (No, Nc, Common) without
accessing TerminalData internals directly.

terminaleditor: add No, Nc, Common entries to type combobox

Expose the three new TerminalData types (No, Nc, Common) in
the element editor UI so users can assign a semantic role to
each terminal of a SW contact element.

Also fix a pre-existing bug in updateForm() where m_type_cb
was incorrectly using m_orientation_cb->findData() instead
of m_type_cb->findData(), preventing the type from being
restored correctly when selecting a terminal.

terminaleditor: add No, Nc, Common entries to type combobox

Expose the three new TerminalData types (No, Nc, Common) in
the element editor UI so users can assign a semantic role to
each terminal of a SW contact element.

Also fix a pre-existing bug in updateForm() where m_type_cb
was incorrectly using m_orientation_cb->findData() instead
of m_type_cb->findData(), preventing the type from being
restored correctly when selecting a terminal.
2026-05-23 02:09:32 +02:00
Kellermorph 86dafcb576 Merge branch 'master' into makro-fix 2026-05-21 20:52:18 +02:00
Kellermorph f416c2a97e New element: Line definition 2026-05-21 20:47:44 +02:00
Laurent Trinques 7426fedba3 crossrefitem: display terminal names on contact symbols in Xref
When a slave element has named terminals in its element definition
(.elmt), the terminal names (e.g. 13/14 for NO, 11/12 for NC,
12/13/14 for SW) are now displayed on each side of the contact
symbol in the cross-reference view.

- NO/NC contacts: name[0] on the left, name[1] on the right
- SW contacts: name[0] (NO) top-left, name[1] (common) top-right,
  name[2] (NC) bottom-left

Terminal names are read from Terminal::name() which is populated
from TerminalData::m_name during element parsing. If terminals are
not named, nothing is displayed (fully backward compatible).

Users are expected to name their own terminals in the element
editor to avoid duplicating elements in the official collection.
2026-05-21 17:10:44 +02:00
Kellermorph 8c557a7f29 follow up: wiring list 2026-05-18 21:31:11 +02:00
Kellermorph 0b79dfd149 Fix and Improve Multi-selection for Diagram Operations 2026-05-13 19:42:11 +02:00
Kellermorph a2b6516eb3 Fixed: Prevented the selection in the project tree from jumping to the last page when saving. 2026-04-30 07:54:53 +02:00
Kellermorph 946aa37e78 delete german notes 2026-04-29 16:17:49 +02:00
Kellermorph b8c85f9e96 Fix placing Template 2026-04-29 16:15:58 +02:00
Kellermorph ee8114d42c Fix Thumbnail in Makrotree 2026-04-29 15:56:00 +02:00
Laurent Trinques fc7d8f5f6f Merge pull request #451 from Kellermorph/makro
Auto-build doxygen docs / doxygen (push) Failing after 2m31s
Auto-build doxygen docs / deploy (push) Has been skipped
Draft: Feature - Introduce User Templates Collection and Dedicated UI Tab
2026-04-26 14:10:07 +02:00
Kellermorph 1d451a6490 Fix include paths for NameList header 2026-04-26 13:01:19 +02:00
Kellermorph 0118d94d4e makro 2026-04-26 10:48:47 +02:00
Laurent Trinques 416ec501fe GenerateSvg: Corrected view:
Auto-build doxygen docs / doxygen (push) Failing after 2m28s
Auto-build doxygen docs / deploy (push) Has been skipped
The contents of svg export is not correctly centered within the exported
area, thanks Tom
https://qelectrotech.org/forum/viewtopic.php?pid=22781#p22781
2026-04-23 09:49:42 +02:00
ChuckNr11 f60acad3b3 Fix losing Focus on moving diagram position with keyboard
Due to the changes made in the commit "Add highlight current page in
ProjectView", there is a problem when moving diagrams in the ProjectView
using the keyboard. The diagrams lose focus after being moved.
The cause is: The DiagramItem loses its selection before the move
function is executed.

The code has been adjusted.
2026-04-19 10:44:52 +02:00
Kellermorph ee65142b65 makro 2026-04-16 12:47:02 +02:00
Kellermorph eb8f859038 Terminal numbering 2026-04-09 08:36:54 +02:00
Laurent Trinques 54e19f4074 Merge pull request #448 from ChuckNr11/master
Supplement to pull request #444 by Kellermorph
2026-04-06 05:50:03 +02:00
Laurent Trinques 8af1fd708f Merge pull request #447 from Kellermorph/feature-verdrahtungsplan
Add RAM-based wiring list export
2026-04-06 05:47:24 +02:00
ChuckNr11 a64e414d63 Fix: incorrect display after deleting a diagram in elements panel 2026-04-05 22:44:35 +02:00
ChuckNr11 2ed8d76e2d add buttons 'one page left/right' to projectView tab bar
Disable the QTabWidget internal scroll buttons and add own buttons for
scroll 'one page left' and scroll 'one page right'. The scrolled
diagrams will be activated.
2026-04-05 22:39:53 +02:00
ChuckNr11 679647f52a Change operation of elementsPanel
corresponding to operation of project and diagram tabs
- click on the item activates the corresponding diagram or project.
- double click opens the corresponding properties editor.
- selecting with the up and down arrow keys has the same effect.
2026-04-05 22:21:34 +02:00
ChuckNr11 a82f6de23b Add highlight current page in ProjectView
- on clicking project tab
- on moving diagram tab
- on adding project
- on adding diagram
2026-04-05 22:11:38 +02:00
ChuckNr11 6452e03cdc refactor: move code to other place for cleaner code
connections for projectviews are made in "addProjectView"
2026-04-05 21:56:33 +02:00
Kellermorph a45a7d4e4d Remove comments about live RAM capture
Removed commented-out code explaining live RAM capture.
2026-04-05 09:09:51 +02:00
Kellermorph bc9173d726 Add RAM-based wiring list export 2026-04-05 08:33:37 +02:00
Laurent Trinques 19712d72ef TYpo
Auto-build doxygen docs / doxygen (push) Failing after 35s
Auto-build doxygen docs / deploy (push) Has been skipped
2026-04-03 14:14:29 +02:00
Laurent Trinques f23ec620dc Typo
Auto-build doxygen docs / doxygen (push) Failing after 35s
Auto-build doxygen docs / deploy (push) Has been skipped
2026-04-02 20:51:19 +02:00
Laurent Trinques 0a4c3f4601 Improve comment! 2026-04-02 17:05:06 +02:00
Laurent Trinques ab24b74c72 Now, elementproperties widget: add MAX contact slave, and count slave
contacts linked to this master, show these informations only when
element type is master.
2026-04-02 15:46:56 +02:00
Laurent Trinques 380d12e675 Typo 2026-04-02 15:35:04 +02:00
Laurent Trinques d0d3194afa On elementpropertieswidget add MAX conctact slave contact and count
slave contacts linked to this master
2026-04-02 15:07:50 +02:00
Kellermorph 9b77b4d4fa Update rectangle height and add QLabel for hidden masters 2026-04-01 16:51:41 +02:00
Kellermorph 225edec091 Translate warning message to French 2026-03-31 20:33:44 +02:00
Kellermorph 62dbaddab2 Update checkbox text for max slaves setting 2026-03-31 20:21:03 +02:00
Kellermorph f5857bb1fd Update comment for clarity in element properties editor 2026-03-31 20:15:35 +02:00
Kellermorph 825eeb77e4 Translate comments to English and clarify filtering logic 2026-03-31 20:14:51 +02:00
Kellermorph 780cf8b054 Set default text color for slave Xref item 2026-03-31 19:57:45 +02:00
Kellermorph 605392cf9b Filter out full MasterElements from elmt_vector
Added filtering for full MasterElements from the list of elements.
2026-03-31 17:53:01 +02:00
Kellermorph 3795ddb1f5 Refactor context menu and link button logic 2026-03-31 17:52:26 +02:00
Kellermorph ecee2209e6 Add isFull method to check Slave-Limit 2026-03-31 17:51:53 +02:00
Kellermorph 246dd0a42f Refactor MasterElement::isFull for clarity 2026-03-31 17:51:32 +02:00
Kellermorph 89a4aaac28 Refactor conditional checks for Master type 2026-03-31 17:50:46 +02:00
Kellermorph 79edc3fbb7 Clean up whitespace in elementdata.h
Removed unnecessary blank lines in elementdata.h
2026-03-31 17:50:22 +02:00
Kellermorph 52f61ab500 Refactor max_slaves handling in ElementPropertiesEditor 2026-03-31 17:49:21 +02:00
Kellermorph 1bbb374094 Update height and add max slaves options in UI 2026-03-31 17:47:45 +02:00
Laurent Trinques c220d84fcb Update elementdata.h 2026-03-31 16:23:05 +02:00
Kellermorph 4834d41432 Merge branch 'master' into master 2026-03-31 14:14:02 +02:00