mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 14:44:15 +02:00
Add cable management: drawing, cores, numbering, cross-references and cable list
Cables are drawn line objects (toolbar button next to the auto break/reconnect button, click-move-click, right click cancels), not components. The type comes from a CSV catalog following the material list pattern (designation, cores, core colours, editable through the entry dialog with "Nouvelle entrée" / "Modifier l'entrée"). Each core is bound to the wire its colour label stands on, and the cable reference is generated per core and written into the Conductor entry via Conductor::setCableReference(label, cable uuid, slot). The conductor entry is where it has to live because the terminal strip plan (Klemmenplan) consumes it in the next step. Numbering: "Cables" rule under Programmeinstellungen/Neues Projekt/Nummerierung auto (mirrored in project properties), literal "W" fallback without a rule, French gate dialog when no rule exists, Nummerierung menu with the renumber dialog (preferred axis, per-folio counter, rule and counter state written back, hand-typed names ask, whole-project scope). Also included: label block and under-line texts with per-text font and alignment plus the material-list cell margins, free-core placement and right-click removal, claim questions for wires of other cables, multi-selection drag as one undo step, type change with confirmation, cross-references for type "Cable" (%f-%l%c, own font, clickable links in exported PDFs), report propagation of the cable definition, Listes menu (table of contents, material list, terminal strip manager, terminal generator plugin, cable list), cable list with freely selectable columns (installation/localisation of cable, start and end, Blatt start/end, length, used cores...), CSV export dialog with column pick and preview in the Projekt menu, script API (addTable kind "cable_list", exportCableList) and a unit test for the type catalog.
This commit is contained in:
@@ -1522,6 +1522,97 @@ QFont QETApp::indiTextsItemFont(qreal size)
|
||||
return(font_);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::cableTextsFont
|
||||
@return the font the texts of a cable (designation, type,
|
||||
installation, location, length) are written with when the cable
|
||||
itself has been given no font of its own.
|
||||
|
||||
That is what the preferences offer on the "Textes" page, and -- when
|
||||
nothing has been chosen there yet -- the font the drawing writes its
|
||||
own texts with, a shade smaller: the way every cable has always been
|
||||
drawn, so that opening the preferences changes nothing until he
|
||||
picks something.
|
||||
*/
|
||||
QFont QETApp::cableTextsFont()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.contains("cable-management/cable-text-font"))
|
||||
{
|
||||
QFont font;
|
||||
if (QETUtils::fontFromString(
|
||||
font, settings.value("cable-management/cable-text-font").toString())) {
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
||||
QFont font = QApplication::font();
|
||||
font.setPointSizeF(font.pointSizeF() * 0.9);
|
||||
return font;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::cableCoreFont
|
||||
@return the font the colour labels of the cores are written with
|
||||
when the cable itself has been given no font of its own.
|
||||
|
||||
That is what the preferences offer on the "Textes" page; until he
|
||||
picks something there, the colours follow the texts of the cable,
|
||||
so one setting alone already resizes the whole label of a cable.
|
||||
*/
|
||||
QFont QETApp::cableCoreFont()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.contains("cable-management/cable-core-font"))
|
||||
{
|
||||
QFont font;
|
||||
if (QETUtils::fontFromString(
|
||||
font, settings.value("cable-management/cable-core-font").toString())) {
|
||||
return font;
|
||||
}
|
||||
}
|
||||
return cableTextsFont();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::cableTextAlignment
|
||||
@return how the texts of a cable line up at the left end of their
|
||||
line when the cable itself asks for nothing: what the preferences
|
||||
offer on the "Textes" page, and -- until he has picked something
|
||||
there -- the way every text has always stood, with its right end at
|
||||
the place where the line begins.
|
||||
*/
|
||||
Qt::Alignment QETApp::cableTextAlignment()
|
||||
{
|
||||
const QSettings settings;
|
||||
const QString name = settings.value("cable-management/cable-align").toString();
|
||||
if (name == QLatin1String("left")) {
|
||||
return Qt::AlignLeft;
|
||||
}
|
||||
if (name == QLatin1String("center")) {
|
||||
return Qt::AlignHCenter;
|
||||
}
|
||||
return Qt::AlignRight;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::setCableTextAlignment
|
||||
Keep what the preferences chose as the way every cable lines up its
|
||||
texts, for the cables which say nothing about it themselves.
|
||||
@param alignment Qt::AlignRight, Qt::AlignHCenter or Qt::AlignLeft
|
||||
*/
|
||||
void QETApp::setCableTextAlignment(Qt::Alignment alignment)
|
||||
{
|
||||
QString name = QLatin1String("right");
|
||||
if (alignment == Qt::AlignLeft) {
|
||||
name = QLatin1String("left");
|
||||
} else if (alignment == Qt::AlignHCenter) {
|
||||
name = QLatin1String("center");
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("cable-management/cable-align", name);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::diagramEditors
|
||||
@return schema editors
|
||||
|
||||
Reference in New Issue
Block a user