mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 14:44:15 +02:00
Merge remote-tracking branch 'upstream/master' into wiring-manager
Conflicts resolved in 24 files. Notable decisions: - ico/icon-themes.qrc: upstream's icon folder restructure kept; the 36 cable icon entries re-added under the new qet/qet-dark path scheme (XML valid, every referenced file exists). - Toolbar system: upstream's DiagramToolbarSettings now owns the toolbar filling. The cable tool is registered as diagrameditor.add_cable (generic group loop) and listed on the "diagram" toolbar right after the auto-break conductor action, separated by a divider, exactly like before the merge. - Paste: the cable lines of a copy are handed to PasteNumberingImport::push() as extra commands, so paste + cable lines + the numbering question stay ONE undo step on both paste paths (DiagramView::paste and DiagramEventAddPaste::commit). - PDF links: upstream's deterministic link sorting kept together with the cable cross-reference injector (injectLinkTo -> links list). - Element renumbering: upstream's ElementAutoNumSchemeCommand::renumber replaces the old formula-based body of QETProject::renumberElementsBySchemeTitle; the cable numbering rule API (cableAutoNum, axis priority, rule name) is kept in full. - Auto-numbering pages: upstream's scheme management kept, the Câbles tab added as index 4 (changeToCableTab), both entry points changeToCable() and changeToElement() kept side by side. - SelectAutonumW: dirty tracking and the contextEdited signal moved into upstream's insertPartRow() row API, so single-rule mode, the rule-removable button and "confirm without change leaves the project alone" keep working. - xrefpropertieswidget: upstream's offset clamping kept; the cable branch (Texte field, Police button, hidden display options) kept; the stack-overlapping checkbox is hidden for cables. Verified after the merge: build green (515/515, no errors), ctest 85/86 (only the pre-existing headless tst_menubarkeyboard failure), offscreen smoke exit 124.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "../ui/shapegraphicsitempropertieswidget.h"
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QSet>
|
||||
#include <QSettings>
|
||||
|
||||
/**
|
||||
@@ -97,22 +98,30 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor(
|
||||
PropertiesEditorWidget *editor,
|
||||
QWidget *parent)
|
||||
{
|
||||
//Selecting a conductor's text label edits its parent conductor (#500),
|
||||
//mirroring how double-clicking the label opens the conductor dialog.
|
||||
//A rubber band over wires selects their labels too: each label
|
||||
//counts as its conductor, once.
|
||||
QList<QGraphicsItem *> mapped;
|
||||
QSet<QGraphicsItem *> seen;
|
||||
for (QGraphicsItem *qgi : std::as_const(items)) {
|
||||
if (auto *cti = qgraphicsitem_cast<ConductorTextItem *>(qgi)) {
|
||||
if (Conductor *parent_cond = cti->parentConductor()) {
|
||||
qgi = parent_cond;
|
||||
}
|
||||
}
|
||||
if (!seen.contains(qgi)) {
|
||||
seen.insert(qgi);
|
||||
mapped << qgi;
|
||||
}
|
||||
}
|
||||
items = mapped;
|
||||
|
||||
const int count_ = items.size();
|
||||
if (count_ == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
QGraphicsItem *item = items.first();
|
||||
|
||||
//Selecting a conductor's text label edits its parent conductor (#500),
|
||||
//mirroring how double-clicking the label opens the conductor dialog.
|
||||
if (count_ == 1) {
|
||||
if (auto *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
||||
if (Conductor *parent_cond = cti->parentConductor()) {
|
||||
items = {parent_cond};
|
||||
item = parent_cond;
|
||||
}
|
||||
}
|
||||
}
|
||||
const int type_ = item->type();
|
||||
|
||||
//The editor widget can only edit one item
|
||||
@@ -139,18 +148,17 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor(
|
||||
false).toBool()) {
|
||||
return nullptr;
|
||||
}
|
||||
//Prototype (#500): single-conductor editing in the dock.
|
||||
if (count_ > 1) {
|
||||
return nullptr;
|
||||
QList<Conductor *> conductors;
|
||||
for (QGraphicsItem *qgi : std::as_const(items)) {
|
||||
conductors << static_cast<Conductor *>(qgi);
|
||||
}
|
||||
auto conductor = static_cast<Conductor*>(item);
|
||||
|
||||
if (class_name == ConductorPropertiesEditorWidget::staticMetaObject.className())
|
||||
{
|
||||
static_cast<ConductorPropertiesEditorWidget*>(editor)->setConductor(conductor);
|
||||
static_cast<ConductorPropertiesEditorWidget*>(editor)->setConductors(conductors);
|
||||
return editor;
|
||||
}
|
||||
return new ConductorPropertiesEditorWidget(conductor, parent);
|
||||
return new ConductorPropertiesEditorWidget(conductors, parent);
|
||||
}
|
||||
case Element::Type: //1000
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user