mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Display conductor number
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "terminalstrip.h"
|
#include "terminalstrip.h"
|
||||||
#include "../qetgraphicsitem/terminalelement.h"
|
#include "../qetgraphicsitem/terminalelement.h"
|
||||||
#include "physicalterminal.h"
|
#include "physicalterminal.h"
|
||||||
|
#include "../qetgraphicsitem/conductor.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RealTerminal
|
* @brief RealTerminal
|
||||||
@@ -175,6 +176,13 @@ QString RealTerminal::cableWire() const {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QString RealTerminal::conductor() const {
|
QString RealTerminal::conductor() const {
|
||||||
|
if (m_element)
|
||||||
|
{
|
||||||
|
const auto conductors_{m_element->conductors()};
|
||||||
|
if (conductors_.size()) {
|
||||||
|
return conductors_.first()->properties().text;
|
||||||
|
}
|
||||||
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const int TYPE_CELL = 2;
|
|||||||
const int FUNCTION_CELL = 3;
|
const int FUNCTION_CELL = 3;
|
||||||
const int LED_CELL = 4;
|
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};
|
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
|
int FreeTerminalModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
return ROW_COUNT;
|
return COLUMN_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,15 +39,15 @@ const int LEVEL_1_CELL = 3;
|
|||||||
const int LEVEL_2_CELL = 4;
|
const int LEVEL_2_CELL = 4;
|
||||||
const int LEVEL_3_CELL = 5;
|
const int LEVEL_3_CELL = 5;
|
||||||
const int LABEL_CELL = 6;
|
const int LABEL_CELL = 6;
|
||||||
const int XREF_CELL = 7;
|
const int CONDUCTOR_CELL = 7;
|
||||||
const int CABLE_CELL = 8;
|
const int XREF_CELL = 8;
|
||||||
const int CABLE_WIRE_CELL = 9;
|
const int CABLE_CELL = 9;
|
||||||
const int TYPE_CELL = 10;
|
const int CABLE_WIRE_CELL = 10;
|
||||||
const int FUNCTION_CELL = 11;
|
const int TYPE_CELL = 11;
|
||||||
const int LED_CELL = 12;
|
const int FUNCTION_CELL = 12;
|
||||||
const int CONDUCTOR_CELL = 13;
|
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};
|
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 4 : return Level2;
|
||||||
case 5 : return Level3;
|
case 5 : return Level3;
|
||||||
case 6 : return Label;
|
case 6 : return Label;
|
||||||
case 7 : return XRef;
|
case 7 : return Conductor;
|
||||||
case 8 : return Cable;
|
case 8 : return XRef;
|
||||||
case 9 : return CableWire;
|
case 9 : return Cable;
|
||||||
case 10 : return Type;
|
case 10 : return CableWire;
|
||||||
case 11 : return Function;
|
case 11 : return Type;
|
||||||
case 12 : return Led;
|
case 12 : return Function;
|
||||||
case 13 : return Conductor;
|
case 13 : return Led;
|
||||||
default : return Invalid;
|
default : return Invalid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ int TerminalStripModel::rowCount(const QModelIndex &parent) const
|
|||||||
int TerminalStripModel::columnCount(const QModelIndex &parent) const
|
int TerminalStripModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
return ROW_COUNT;
|
return COLUMN_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant TerminalStripModel::data(const QModelIndex &index, int role) const
|
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 POS_CELL : return physicalDataAtIndex(index.row()).pos_;
|
||||||
case LEVEL_CELL : return mrtd.level_;
|
case LEVEL_CELL : return mrtd.level_;
|
||||||
case LABEL_CELL : return mrtd.label_;
|
case LABEL_CELL : return mrtd.label_;
|
||||||
|
case CONDUCTOR_CELL : return mrtd.conductor_;
|
||||||
case XREF_CELL : return mrtd.Xref_;
|
case XREF_CELL : return mrtd.Xref_;
|
||||||
case CABLE_CELL : return mrtd.cable_;
|
case CABLE_CELL : return mrtd.cable_;
|
||||||
case CABLE_WIRE_CELL : return mrtd.cable_wire;
|
case CABLE_WIRE_CELL : return mrtd.cable_wire;
|
||||||
case TYPE_CELL : return ElementData::translatedTerminalType(mrtd.type_);
|
case TYPE_CELL : return ElementData::translatedTerminalType(mrtd.type_);
|
||||||
case FUNCTION_CELL : return ElementData::translatedTerminalFunction(mrtd.function_);
|
case FUNCTION_CELL : return ElementData::translatedTerminalFunction(mrtd.function_);
|
||||||
case CONDUCTOR_CELL : return mrtd.conductor_;
|
|
||||||
default : return QVariant();
|
default : return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,13 +287,13 @@ QVariant TerminalStripModel::headerData(int section, Qt::Orientation orientation
|
|||||||
case LEVEL_2_CELL: return QStringLiteral("2");
|
case LEVEL_2_CELL: return QStringLiteral("2");
|
||||||
case LEVEL_3_CELL: return QStringLiteral("3");
|
case LEVEL_3_CELL: return QStringLiteral("3");
|
||||||
case LABEL_CELL: return tr("Label");
|
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 XREF_CELL: return tr("Référence croisé");
|
||||||
case CABLE_CELL: return tr("Câble");
|
case CABLE_CELL: return tr("Câble");
|
||||||
case CABLE_WIRE_CELL: return tr("Couleur / numéro de fil câble");
|
case CABLE_WIRE_CELL: return tr("Couleur / numéro de fil câble");
|
||||||
case TYPE_CELL: return tr("Type");
|
case TYPE_CELL: return tr("Type");
|
||||||
case FUNCTION_CELL : return tr("Fonction");
|
case FUNCTION_CELL : return tr("Fonction");
|
||||||
case LED_CELL: return tr("led");
|
case LED_CELL: return tr("led");
|
||||||
case CONDUCTOR_CELL: return tr("Numéro de conducteur");
|
|
||||||
default : return QVariant();
|
default : return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,13 +54,13 @@ class TerminalStripModel : public QAbstractTableModel
|
|||||||
Level2 = 4,
|
Level2 = 4,
|
||||||
Level3 = 5,
|
Level3 = 5,
|
||||||
Label = 6,
|
Label = 6,
|
||||||
XRef = 7,
|
Conductor = 7,
|
||||||
Cable = 8,
|
XRef = 8,
|
||||||
CableWire = 9,
|
Cable = 9,
|
||||||
Type = 10,
|
CableWire = 10,
|
||||||
Function = 11,
|
Type = 11,
|
||||||
Led = 12,
|
Function = 12,
|
||||||
Conductor = 13,
|
Led = 13,
|
||||||
Invalid = 99
|
Invalid = 99
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user