Reapply "Add cable management: drawing, cores, numbering, cross-references and cable list"

This reverts commit 2bb3343d2d.
This commit is contained in:
Laurent Trinques
2026-10-11 05:00:01 +02:00
parent 124a889be3
commit 1cd8fadbc4
113 changed files with 18793 additions and 209 deletions
+37 -1
View File
@@ -18,6 +18,10 @@
#include "propertieseditorfactory.h"
#include "../PropertiesEditor/propertieseditorwidget.h"
#include "../cable/cablepart.h"
#include "../cable/cablepropertieseditorwidget.h"
#include "../cablelist/cablelistmodel.h"
#include "../cablelist/cablelistmodelpropertieswidget.h"
#include "../qetgraphicsitem/ViewItem/projectdbmodel.h"
#include "../qetgraphicsitem/ViewItem/qetgraphicstableitem.h"
#include "../qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.h"
@@ -55,7 +59,7 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor(
PropertiesEditorWidget *editor,
QWidget *parent)
{
if (auto m = static_cast<ProjectDBModel *>(model))
if (auto m = dynamic_cast<ProjectDBModel *>(model))
{
if (editor &&
editor->metaObject()->className()
@@ -66,6 +70,17 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor(
}
return new ProjectDBModelPropertiesWidget(m, parent);
}
if (auto m = dynamic_cast<CableListModel *>(model))
{
if (editor &&
editor->metaObject()->className()
== CableListModelPropertiesWidget::staticMetaObject.className())
{
static_cast<CableListModelPropertiesWidget *>(editor)->setModel(m);
return editor;
}
return new CableListModelPropertiesWidget(m, parent);
}
return nullptr;
}
@@ -247,6 +262,27 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor(
}
return new GraphicsTablePropertiesEditor(table, parent);
}
case CablePart::Type: //1012
{
if (count_ > 1) {
return nullptr;
}
auto part = static_cast<CablePart *>(item);
//The fields belong to the cable, never to one of its
//lines: whichever line is picked, it is the cable which
//is edited.
Cable *cable = part->cable();
if (!cable) {
return nullptr;
}
if (class_name == CablePropertiesEditorWidget::staticMetaObject.className())
{
static_cast<CablePropertiesEditorWidget *>(editor)->setCable(cable, part);
return editor;
}
return new CablePropertiesEditorWidget(cable, part, parent);
}
default:
return nullptr;
}