Display conductor number

This commit is contained in:
joshua 2022-06-14 19:30:45 +02:00
parent 5c6b9f1829
commit 2e15372aab
4 changed files with 35 additions and 27 deletions

View File

@ -19,6 +19,7 @@
#include "terminalstrip.h"
#include "../qetgraphicsitem/terminalelement.h"
#include "physicalterminal.h"
#include "../qetgraphicsitem/conductor.h"
/**
* @brief RealTerminal
@ -175,6 +176,13 @@ QString RealTerminal::cableWire() const {
* @return
*/
QString RealTerminal::conductor() const {
if (m_element)
{
const auto conductors_{m_element->conductors()};
if (conductors_.size()) {
return conductors_.first()->properties().text;
}
}
return QString();
}

View File

@ -29,7 +29,7 @@ const int TYPE_CELL = 2;
const int FUNCTION_CELL = 3;
const int LED_CELL = 4;
const int ROW_COUNT = 5;
const int COLUMN_COUNT = 5;
static QVector<bool> UNMODIFIED_CELL_VECTOR{false, false, false, false, false};
@ -79,7 +79,7 @@ int FreeTerminalModel::rowCount(const QModelIndex &parent) const
int FreeTerminalModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return ROW_COUNT;
return COLUMN_COUNT;
}
/**

View File

@ -39,15 +39,15 @@ const int LEVEL_1_CELL = 3;
const int LEVEL_2_CELL = 4;
const int LEVEL_3_CELL = 5;
const int LABEL_CELL = 6;
const int XREF_CELL = 7;
const int CABLE_CELL = 8;
const int CABLE_WIRE_CELL = 9;
const int TYPE_CELL = 10;
const int FUNCTION_CELL = 11;
const int LED_CELL = 12;
const int CONDUCTOR_CELL = 13;
const int CONDUCTOR_CELL = 7;
const int XREF_CELL = 8;
const int CABLE_CELL = 9;
const int CABLE_WIRE_CELL = 10;
const int TYPE_CELL = 11;
const int FUNCTION_CELL = 12;
const int LED_CELL = 13;
const int ROW_COUNT = 13;
const int COLUMN_COUNT = 14;
static QVector<bool> UNMODIFIED_CELL_VECTOR{false, false, false, false, false, false, false, false, false, false, false, false, false, false};
@ -86,13 +86,13 @@ TerminalStripModel::Column TerminalStripModel::columnTypeForIndex(const QModelIn
case 4 : return Level2;
case 5 : return Level3;
case 6 : return Label;
case 7 : return XRef;
case 8 : return Cable;
case 9 : return CableWire;
case 10 : return Type;
case 11 : return Function;
case 12 : return Led;
case 13 : return Conductor;
case 7 : return Conductor;
case 8 : return XRef;
case 9 : return Cable;
case 10 : return CableWire;
case 11 : return Type;
case 12 : return Function;
case 13 : return Led;
default : return Invalid;
}
}
@ -146,7 +146,7 @@ int TerminalStripModel::rowCount(const QModelIndex &parent) const
int TerminalStripModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return ROW_COUNT;
return COLUMN_COUNT;
}
QVariant TerminalStripModel::data(const QModelIndex &index, int role) const
@ -164,12 +164,12 @@ QVariant TerminalStripModel::data(const QModelIndex &index, int role) const
case POS_CELL : return physicalDataAtIndex(index.row()).pos_;
case LEVEL_CELL : return mrtd.level_;
case LABEL_CELL : return mrtd.label_;
case CONDUCTOR_CELL : return mrtd.conductor_;
case XREF_CELL : return mrtd.Xref_;
case CABLE_CELL : return mrtd.cable_;
case CABLE_WIRE_CELL : return mrtd.cable_wire;
case TYPE_CELL : return ElementData::translatedTerminalType(mrtd.type_);
case FUNCTION_CELL : return ElementData::translatedTerminalFunction(mrtd.function_);
case CONDUCTOR_CELL : return mrtd.conductor_;
default : return QVariant();
}
}
@ -287,13 +287,13 @@ QVariant TerminalStripModel::headerData(int section, Qt::Orientation orientation
case LEVEL_2_CELL: return QStringLiteral("2");
case LEVEL_3_CELL: return QStringLiteral("3");
case LABEL_CELL: return tr("Label");
case CONDUCTOR_CELL: return tr("Numéro de conducteur");
case XREF_CELL: return tr("Référence croisé");
case CABLE_CELL: return tr("Câble");
case CABLE_WIRE_CELL: return tr("Couleur / numéro de fil câble");
case TYPE_CELL: return tr("Type");
case FUNCTION_CELL : return tr("Fonction");
case LED_CELL: return tr("led");
case CONDUCTOR_CELL: return tr("Numéro de conducteur");
default : return QVariant();
}
}

View File

@ -54,13 +54,13 @@ class TerminalStripModel : public QAbstractTableModel
Level2 = 4,
Level3 = 5,
Label = 6,
XRef = 7,
Cable = 8,
CableWire = 9,
Type = 10,
Function = 11,
Led = 12,
Conductor = 13,
Conductor = 7,
XRef = 8,
Cable = 9,
CableWire = 10,
Type = 11,
Function = 12,
Led = 13,
Invalid = 99
};