mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-03 19:10:53 +01:00
Add table widget and item model for free terminal
WIP, the change made in the table widget can't be applied.
This commit is contained in:
@@ -306,8 +306,7 @@ Qt::ItemFlags TerminalStripModel::flags(const QModelIndex &index) const
|
||||
|
||||
/**
|
||||
* @brief TerminalStripModel::modifiedRealTerminalData
|
||||
* @return a vector of QPair of modified terminal.
|
||||
* the first value of the QPair is the original data, the second value is the edited data
|
||||
* @return a vector of modified terminal.
|
||||
*/
|
||||
QVector<modelRealTerminalData> TerminalStripModel::modifiedmodelRealTerminalData() const
|
||||
{
|
||||
@@ -495,7 +494,7 @@ void TerminalStripModel::fillPhysicalTerminalData()
|
||||
{
|
||||
if (!real_t.isNull())
|
||||
{
|
||||
mptd.real_data.append(modelRealData(real_t));
|
||||
mptd.real_data.append(modelRealTerminalData::data(real_t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,7 +683,7 @@ QPixmap TerminalStripModel::bridgePixmapFor(const QModelIndex &index) const
|
||||
modelRealTerminalData previous_data;
|
||||
|
||||
do {
|
||||
current_real_terminal = modelRealData(m_terminal_strip->previousRealTerminal(current_real_terminal.real_terminal));
|
||||
current_real_terminal = modelRealTerminalData::data(m_terminal_strip->previousRealTerminal(current_real_terminal.real_terminal));
|
||||
|
||||
if (current_real_terminal.level_ == -1) {
|
||||
break;
|
||||
@@ -719,7 +718,7 @@ QPixmap TerminalStripModel::bridgePixmapFor(const QModelIndex &index) const
|
||||
modelRealTerminalData next_data;
|
||||
|
||||
do {
|
||||
current_real_terminal = modelRealData(m_terminal_strip->nextRealTerminal(current_real_terminal.real_terminal));
|
||||
current_real_terminal = modelRealTerminalData::data(m_terminal_strip->nextRealTerminal(current_real_terminal.real_terminal));
|
||||
|
||||
if (current_real_terminal.level_ == -1) {
|
||||
break;
|
||||
@@ -758,29 +757,6 @@ QPixmap TerminalStripModel::bridgePixmapFor(const QModelIndex &index) const
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
modelRealTerminalData TerminalStripModel::modelRealData(const QWeakPointer<RealTerminal> &real_terminal)
|
||||
{
|
||||
modelRealTerminalData mrtd;
|
||||
const auto real_t = real_terminal.toStrongRef();
|
||||
if (!real_terminal.isNull())
|
||||
{
|
||||
mrtd.level_ = real_t->level();
|
||||
mrtd.label_ = real_t->label();
|
||||
mrtd.Xref_ = real_t->Xref();
|
||||
mrtd.cable_ = real_t->cable();
|
||||
mrtd.cable_wire = real_t->cableWire();
|
||||
mrtd.conductor_ = real_t->conductor();
|
||||
mrtd.led_ = real_t->isLed();
|
||||
mrtd.type_ = real_t->type();
|
||||
mrtd.function_ = real_t->function();
|
||||
mrtd.element_ = real_t->element();
|
||||
mrtd.real_terminal = real_terminal;
|
||||
mrtd.bridged_ = real_t->isBridged();
|
||||
}
|
||||
|
||||
return mrtd;
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* A little delegate for add a combobox to edit type
|
||||
* and a spinbox to edit the level of a terminal
|
||||
|
||||
Reference in New Issue
Block a user