From 0cf7975be382cd1cffa4be6c0425d526ee6aa5af Mon Sep 17 00:00:00 2001 From: ispyisail Date: Thu, 1 Oct 2026 13:03:18 +1300 Subject: [PATCH] Fix bugtracker #344: folio "one text per potential" applies at once Ticking or unticking "Afficher un texte de potentiel par folio" in Folio > Properties only assigned Diagram::defaultConductorProperties. Nothing recalculated the conductor texts, so texts hidden by the option stayed hidden after it was turned off (and duplicates stayed visible after it was turned on) until each wire was edited or the project was reopened. That made the option look broken, which is part of what #344 reports. When the option changes, reset each conductor's text visibility from its own properties, then run calculateTextItemPosition() on every conductor of the folio so the option is applied again from scratch. Checked in the GUI on examples/industrial.qet folio 4 (26 wires with text, 19 potentials), master vs this commit: unticking now shows the hidden texts immediately, ticking hides the duplicates immediately; master's drawing does not change in either direction. Co-Authored-By: Claude Opus 5.5 --- sources/ui/diagrampropertiesdialog.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sources/ui/diagrampropertiesdialog.cpp b/sources/ui/diagrampropertiesdialog.cpp index 75f05fa70..673da010f 100644 --- a/sources/ui/diagrampropertiesdialog.cpp +++ b/sources/ui/diagrampropertiesdialog.cpp @@ -19,6 +19,8 @@ #include "../diagram.h" #include "../diagramcommands.h" +#include "../qetgraphicsitem/conductor.h" +#include "../qetgraphicsitem/conductortextitem.h" #include "../undocommand/changetitleblockcommand.h" #include "borderpropertieswidget.h" #include "conductorpropertieswidget.h" @@ -115,6 +117,20 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare #endif /// TODO implement an undo command to allow the user to undo/redo this action diagram -> defaultConductorProperties = new_conductors; + + // "One text per potential" changed: show or hide the + // conductor texts now, not at the next edit or reload. + if (new_conductors.m_one_text_per_folio != conductors.m_one_text_per_folio) + { + const QList conductor_list = diagram -> conductors(); + for (Conductor *c : conductor_list) + { + const ConductorProperties cp = c -> properties(); + c -> textItem() -> setVisible(cp.type == ConductorProperties::Multi && cp.m_show_text); + } + for (Conductor *c : conductor_list) + c -> calculateTextItemPosition(); + } } // Conductor autonum name