Warn with a pop-up, not a box, when a wires-per-terminal rule is turned on

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
This commit is contained in:
ispyisail
2026-10-04 01:43:21 +13:00
parent 9a55939bb4
commit 3150b42087
8 changed files with 60 additions and 42 deletions
+17
View File
@@ -195,6 +195,23 @@ private slots:
QCOMPARE(WiringRules::effective(own, application).max_wires, 6);
}
void warnsWhenARuleIsTurnedOn()
{
WiringRules::Settings off;
WiringRules::Settings limit;
limit.max_wires = 4;
WiringRules::Settings report;
report.one_wire_per_report = true;
QVERIFY(WiringRules::turnsRuleOn(off, limit));
QVERIFY(WiringRules::turnsRuleOn(off, report));
QVERIFY(WiringRules::turnsRuleOn(limit, [&]{ auto s = limit; s.one_wire_per_report = true; return s; }()));
// Changing a limit that was already on, or turning rules off: no warning
QVERIFY(!WiringRules::turnsRuleOn(limit, [&]{ auto s = limit; s.max_wires = 2; return s; }()));
QVERIFY(!WiringRules::turnsRuleOn(limit, off));
QVERIFY(!WiringRules::turnsRuleOn(off, off));
}
void xmlRoundTrip()
{
QDomDocument doc;