mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-02 16:44:16 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 *> 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
|
||||
|
||||
Reference in New Issue
Block a user