mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Add terminalStripModel class
This commit is contained in:
parent
364bce618c
commit
a1e18d2bba
@ -21,6 +21,7 @@
|
|||||||
#include "../qetgraphicsitem/terminalelement.h"
|
#include "../qetgraphicsitem/terminalelement.h"
|
||||||
#include "../elementprovider.h"
|
#include "../elementprovider.h"
|
||||||
#include "../qetxml.h"
|
#include "../qetxml.h"
|
||||||
|
#include "../autoNum/assignvariables.h"
|
||||||
|
|
||||||
using shared_real_terminal = QSharedPointer<RealTerminal>;
|
using shared_real_terminal = QSharedPointer<RealTerminal>;
|
||||||
using shared_physical_terminal = QSharedPointer<PhysicalTerminal>;
|
using shared_physical_terminal = QSharedPointer<PhysicalTerminal>;
|
||||||
@ -82,6 +83,14 @@ class RealTerminal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElementData::TerminalType type() const {
|
||||||
|
if (m_element) {
|
||||||
|
return m_element->elementData().m_terminal_type;
|
||||||
|
} else {
|
||||||
|
return ElementData::TTGeneric;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief elementUuid
|
* @brief elementUuid
|
||||||
* @return if this real terminal is an element
|
* @return if this real terminal is an element
|
||||||
@ -234,6 +243,16 @@ class PhysicalTerminal
|
|||||||
return m_real_terminal.size();
|
return m_real_terminal.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief levelOf
|
||||||
|
* @param terminal
|
||||||
|
* @return the level of real terminal \p terminal or
|
||||||
|
* -1 if \terminal is not a part of this physicalTerminal
|
||||||
|
*/
|
||||||
|
int levelOf(shared_real_terminal terminal) const {
|
||||||
|
return m_real_terminal.indexOf(terminal);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief terminals
|
* @brief terminals
|
||||||
* @return A vector of real terminal who compose this physical terminal
|
* @return A vector of real terminal who compose this physical terminal
|
||||||
@ -433,6 +452,16 @@ int TerminalStrip::physicalTerminalCount() const {
|
|||||||
return m_physical_terminals.size();
|
return m_physical_terminals.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TerminalStrip::realTerminalCount
|
||||||
|
* @return the number of real terminal.
|
||||||
|
* A real terminal is a part of a physical terminal.
|
||||||
|
*/
|
||||||
|
int TerminalStrip::realTerminalCount() const
|
||||||
|
{
|
||||||
|
return m_real_terminals.size();
|
||||||
|
}
|
||||||
|
|
||||||
TerminalStripIndex TerminalStrip::index(int index)
|
TerminalStripIndex TerminalStrip::index(int index)
|
||||||
{
|
{
|
||||||
TerminalStripIndex tsi_;
|
TerminalStripIndex tsi_;
|
||||||
@ -537,6 +566,31 @@ bool TerminalStrip::fromXml(QDomElement &xml_element)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RealTerminalData TerminalStrip::realTerminalData(int real_terminal_index)
|
||||||
|
{
|
||||||
|
RealTerminalData rtd;
|
||||||
|
if (m_real_terminals.isEmpty() ||
|
||||||
|
real_terminal_index >= m_real_terminals.size()) {
|
||||||
|
return rtd;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto real_terminal = m_real_terminals.at(real_terminal_index);
|
||||||
|
auto physical_terminal = physicalTerminal(real_terminal);
|
||||||
|
|
||||||
|
rtd.m_real_terminal = m_real_terminals.at(real_terminal_index);
|
||||||
|
rtd.pos_ = m_physical_terminals.indexOf(physical_terminal);
|
||||||
|
rtd.level_ = physical_terminal->levelOf(real_terminal);
|
||||||
|
rtd.label_ = real_terminal->label();
|
||||||
|
|
||||||
|
if (real_terminal->isElement()) {
|
||||||
|
rtd.Xref_ = autonum::AssignVariables::genericXref(real_terminal->element());
|
||||||
|
}
|
||||||
|
rtd.type_ = real_terminal->type();
|
||||||
|
rtd.is_element = real_terminal->isElement();
|
||||||
|
|
||||||
|
return rtd;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief TerminalStrip::realTerminal
|
* @brief TerminalStrip::realTerminal
|
||||||
* @param terminal
|
* @param terminal
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include "terminalstripdata.h"
|
#include "terminalstripdata.h"
|
||||||
|
#include "../properties/elementdata.h"
|
||||||
|
|
||||||
class Element;
|
class Element;
|
||||||
class RealTerminal;
|
class RealTerminal;
|
||||||
@ -29,6 +30,26 @@ class PhysicalTerminal;
|
|||||||
class TerminalStripIndex;
|
class TerminalStripIndex;
|
||||||
class TerminalElement;
|
class TerminalElement;
|
||||||
|
|
||||||
|
|
||||||
|
struct RealTerminalData
|
||||||
|
{
|
||||||
|
QSharedPointer<RealTerminal> m_real_terminal;
|
||||||
|
|
||||||
|
int pos_ = 0,
|
||||||
|
level_ = 0;
|
||||||
|
|
||||||
|
QString label_,
|
||||||
|
Xref_,
|
||||||
|
cable_,
|
||||||
|
cable_wire_,
|
||||||
|
conductor_;
|
||||||
|
|
||||||
|
ElementData::TerminalType type_;
|
||||||
|
|
||||||
|
bool led_ = false,
|
||||||
|
is_element = false;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The TerminalStrip class
|
* @brief The TerminalStrip class
|
||||||
* This class hold all the datas and configurations
|
* This class hold all the datas and configurations
|
||||||
@ -38,6 +59,8 @@ class TerminalElement;
|
|||||||
*/
|
*/
|
||||||
class TerminalStrip : public QObject
|
class TerminalStrip : public QObject
|
||||||
{
|
{
|
||||||
|
friend class TerminalStripModel;
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TerminalStrip(QETProject *project);
|
TerminalStrip(QETProject *project);
|
||||||
@ -67,7 +90,9 @@ class TerminalStrip : public QObject
|
|||||||
bool haveTerminal (Element *terminal);
|
bool haveTerminal (Element *terminal);
|
||||||
|
|
||||||
int physicalTerminalCount() const;
|
int physicalTerminalCount() const;
|
||||||
|
int realTerminalCount() const;
|
||||||
TerminalStripIndex index(int index = 0);
|
TerminalStripIndex index(int index = 0);
|
||||||
|
RealTerminalData realTerminalData(int real_terminal_index);
|
||||||
|
|
||||||
QVector<QPointer<Element>> terminalElement() const;
|
QVector<QPointer<Element>> terminalElement() const;
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "../UndoCommand/changeterminalstripdata.h"
|
#include "../UndoCommand/changeterminalstripdata.h"
|
||||||
#include "terminalstriptreewidget.h"
|
#include "terminalstriptreewidget.h"
|
||||||
#include "../../qeticons.h"
|
#include "../../qeticons.h"
|
||||||
|
#include "terminalstripmodel.h"
|
||||||
|
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
|
|
||||||
@ -235,16 +236,46 @@ void TerminalStripEditor::addFreeTerminal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief TerminalStripEditor::clearDataTab
|
* @brief TerminalStripEditor::setCurrentStrip
|
||||||
|
* Set the current terminal strip edited to \p strip_
|
||||||
|
* @param strip_
|
||||||
*/
|
*/
|
||||||
void TerminalStripEditor::clearDataTab()
|
void TerminalStripEditor::setCurrentStrip(TerminalStrip *strip_)
|
||||||
{
|
{
|
||||||
|
if (strip_ == m_current_strip) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strip_)
|
||||||
|
{
|
||||||
ui->m_installation_le ->clear();
|
ui->m_installation_le ->clear();
|
||||||
ui->m_location_le ->clear();
|
ui->m_location_le ->clear();
|
||||||
ui->m_name_le ->clear();
|
ui->m_name_le ->clear();
|
||||||
ui->m_comment_le ->clear();
|
ui->m_comment_le ->clear();
|
||||||
ui->m_description_te ->clear();
|
ui->m_description_te ->clear();
|
||||||
m_current_strip = nullptr;
|
m_current_strip = nullptr;
|
||||||
|
|
||||||
|
ui->m_table_widget->setModel(nullptr);
|
||||||
|
if (m_model) {
|
||||||
|
m_model->deleteLater();
|
||||||
|
m_model = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->m_installation_le ->setText(strip_->installation());
|
||||||
|
ui->m_location_le ->setText(strip_->location());
|
||||||
|
ui->m_name_le ->setText(strip_->name());
|
||||||
|
ui->m_comment_le ->setText(strip_->comment());
|
||||||
|
ui->m_description_te ->setPlainText(strip_->description());
|
||||||
|
m_current_strip = strip_;
|
||||||
|
|
||||||
|
if (m_model)
|
||||||
|
m_model->deleteLater();
|
||||||
|
|
||||||
|
m_model = new TerminalStripModel(strip_, this);
|
||||||
|
ui->m_table_widget->setModel(m_model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -310,7 +341,7 @@ void TerminalStripEditor::on_m_reload_pb_clicked()
|
|||||||
m_uuid_terminal_H.clear();
|
m_uuid_terminal_H.clear();
|
||||||
m_uuid_strip_H.clear();
|
m_uuid_strip_H.clear();
|
||||||
|
|
||||||
qDeleteAll(m_item_strip_H.keys());
|
qDeleteAll(m_item_strip_H.keyBegin(), m_item_strip_H.keyEnd());
|
||||||
|
|
||||||
buildTree();
|
buildTree();
|
||||||
ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex());
|
ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex());
|
||||||
@ -332,7 +363,7 @@ void TerminalStripEditor::on_m_terminal_strip_tw_currentItemChanged(QTreeWidgetI
|
|||||||
Q_UNUSED(previous)
|
Q_UNUSED(previous)
|
||||||
|
|
||||||
if (!current) {
|
if (!current) {
|
||||||
clearDataTab();
|
setCurrentStrip(nullptr);
|
||||||
ui->m_remove_terminal_strip_pb->setDisabled(true);
|
ui->m_remove_terminal_strip_pb->setDisabled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -351,16 +382,7 @@ void TerminalStripEditor::on_m_terminal_strip_tw_currentItemChanged(QTreeWidgetI
|
|||||||
ui->m_remove_terminal_strip_pb->setDisabled(true);
|
ui->m_remove_terminal_strip_pb->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strip_) {
|
setCurrentStrip(strip_);
|
||||||
m_current_strip = strip_;
|
|
||||||
ui->m_installation_le ->setText(strip_->installation());
|
|
||||||
ui->m_location_le ->setText(strip_->location());
|
|
||||||
ui->m_name_le ->setText(strip_->name());
|
|
||||||
ui->m_comment_le ->setText(strip_->comment());
|
|
||||||
ui->m_description_te ->setPlainText(strip_->description());
|
|
||||||
} else {
|
|
||||||
clearDataTab();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalStripEditor::on_m_apply_data_pb_clicked(QAbstractButton *button)
|
void TerminalStripEditor::on_m_apply_data_pb_clicked(QAbstractButton *button)
|
||||||
|
@ -29,6 +29,7 @@ class TerminalStrip;
|
|||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
class TerminalElement;
|
class TerminalElement;
|
||||||
class QAbstractButton;
|
class QAbstractButton;
|
||||||
|
class TerminalStripModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The TerminalStripEditor class
|
* @brief The TerminalStripEditor class
|
||||||
@ -48,7 +49,7 @@ class TerminalStripEditor : public QDialog
|
|||||||
void buildTree();
|
void buildTree();
|
||||||
QTreeWidgetItem* addTerminalStrip(TerminalStrip *terminal_strip);
|
QTreeWidgetItem* addTerminalStrip(TerminalStrip *terminal_strip);
|
||||||
void addFreeTerminal();
|
void addFreeTerminal();
|
||||||
void clearDataTab();
|
void setCurrentStrip(TerminalStrip *strip_);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_add_terminal_strip_pb_clicked();
|
void on_m_add_terminal_strip_pb_clicked();
|
||||||
@ -65,6 +66,7 @@ class TerminalStripEditor : public QDialog
|
|||||||
QHash<QUuid, QPointer<TerminalElement>> m_uuid_terminal_H;
|
QHash<QUuid, QPointer<TerminalElement>> m_uuid_terminal_H;
|
||||||
QHash<QUuid, QPointer<TerminalStrip>> m_uuid_strip_H;
|
QHash<QUuid, QPointer<TerminalStrip>> m_uuid_strip_H;
|
||||||
TerminalStrip *m_current_strip = nullptr;
|
TerminalStrip *m_current_strip = nullptr;
|
||||||
|
TerminalStripModel *m_model = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TERMINALSTRIPEDITOR_H
|
#endif // TERMINALSTRIPEDITOR_H
|
||||||
|
@ -130,13 +130,19 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="tableView">
|
<widget class="QTableView" name="m_table_widget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -262,7 +268,7 @@
|
|||||||
<tabstop>m_name_le</tabstop>
|
<tabstop>m_name_le</tabstop>
|
||||||
<tabstop>m_comment_le</tabstop>
|
<tabstop>m_comment_le</tabstop>
|
||||||
<tabstop>m_description_te</tabstop>
|
<tabstop>m_description_te</tabstop>
|
||||||
<tabstop>tableView</tabstop>
|
<tabstop>m_table_widget</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../qelectrotech.qrc"/>
|
<include location="../../../qelectrotech.qrc"/>
|
||||||
|
101
sources/TerminalStrip/ui/terminalstripmodel.cpp
Normal file
101
sources/TerminalStrip/ui/terminalstripmodel.cpp
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2021 The QElectroTech Team
|
||||||
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
QElectroTech is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include "terminalstripmodel.h"
|
||||||
|
#include "../terminalstrip.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TerminalStripModel::TerminalStripModel
|
||||||
|
* @param terminal_strip
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
TerminalStripModel::TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent) :
|
||||||
|
QAbstractTableModel(parent),
|
||||||
|
m_terminal_strip(terminal_strip)
|
||||||
|
{
|
||||||
|
fillRealTerminalData();
|
||||||
|
}
|
||||||
|
|
||||||
|
int TerminalStripModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
if (!m_terminal_strip) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_terminal_strip->realTerminalCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
int TerminalStripModel::columnCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant TerminalStripModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
if (role != Qt::DisplayRole ||
|
||||||
|
index.row() >= m_real_terminal_data.size()) {
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto rtd = m_real_terminal_data.at(index.row());
|
||||||
|
switch (index.column()) {
|
||||||
|
case 0 : return rtd.pos_;
|
||||||
|
case 1 : return rtd.level_;
|
||||||
|
case 2 : return rtd.label_;
|
||||||
|
case 3 : return rtd.Xref_;
|
||||||
|
case 4 : return rtd.cable_;
|
||||||
|
case 5 : return rtd.cable_wire_;
|
||||||
|
case 6 : return ElementData::translatedTerminalType(rtd.type_);
|
||||||
|
case 7 : return rtd.led_;
|
||||||
|
case 8 : return rtd.conductor_;
|
||||||
|
default : return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant TerminalStripModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
{
|
||||||
|
if (orientation != Qt::Horizontal ||
|
||||||
|
role != Qt::DisplayRole) {
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (section) {
|
||||||
|
case 0: return tr("Position");
|
||||||
|
case 1: return tr("Étage");
|
||||||
|
case 2: return tr("Label");
|
||||||
|
case 3: return tr("Référence croisé");
|
||||||
|
case 4: return tr("Câble");
|
||||||
|
case 5: return tr("Couleur / numéro de fil câble");
|
||||||
|
case 6: return tr("Type");
|
||||||
|
case 7: return tr("led");
|
||||||
|
case 8: return tr("Numéro de conducteur");
|
||||||
|
default : return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TerminalStripModel::fillRealTerminalData()
|
||||||
|
{
|
||||||
|
if (m_terminal_strip) {
|
||||||
|
for (int i=0 ; i < m_terminal_strip->realTerminalCount() ; ++i) {
|
||||||
|
m_real_terminal_data.append(m_terminal_strip->realTerminalData(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
sources/TerminalStrip/ui/terminalstripmodel.h
Normal file
47
sources/TerminalStrip/ui/terminalstripmodel.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2021 The QElectroTech Team
|
||||||
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
QElectroTech is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef TERMINALSTRIPMODEL_H
|
||||||
|
#define TERMINALSTRIPMODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractTableModel>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QPointer>
|
||||||
|
#include "../terminalstrip.h"
|
||||||
|
|
||||||
|
class TerminalStrip;
|
||||||
|
|
||||||
|
class TerminalStripModel : public QAbstractTableModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
virtual int rowCount (const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
virtual int columnCount (const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
|
virtual QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void fillRealTerminalData();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPointer<TerminalStrip> m_terminal_strip;
|
||||||
|
QVector<RealTerminalData> m_real_terminal_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TERMINALSTRIPMODEL_H
|
@ -233,6 +233,33 @@ namespace autonum
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AssignVariables::genericXref
|
||||||
|
* @param element
|
||||||
|
* @return a simple Xref string in form of 'folio-letterNumber'
|
||||||
|
*/
|
||||||
|
QString AssignVariables::genericXref(const Element *element)
|
||||||
|
{
|
||||||
|
QString str;
|
||||||
|
if (!element->diagram()) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
auto diagram = element->diagram();
|
||||||
|
if (settings.value(QLatin1String("genericpanel/folio"), true).toBool()) {
|
||||||
|
str = diagram->border_and_titleblock.finalfolio();
|
||||||
|
} else {
|
||||||
|
str = QString::number(diagram->folioIndex()+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
str.append("-");
|
||||||
|
str.append(diagram->convertPosition(element->scenePos()).toString());
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
AssignVariables::AssignVariables(const QString& formula,
|
AssignVariables::AssignVariables(const QString& formula,
|
||||||
const sequentialNumbers& seqStruct,
|
const sequentialNumbers& seqStruct,
|
||||||
|
@ -63,6 +63,7 @@ namespace autonum
|
|||||||
public:
|
public:
|
||||||
static QString formulaToLabel (QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt = nullptr);
|
static QString formulaToLabel (QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt = nullptr);
|
||||||
static QString replaceVariable (const QString &formula, const DiagramContext &dc);
|
static QString replaceVariable (const QString &formula, const DiagramContext &dc);
|
||||||
|
static QString genericXref (const Element *element);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr);
|
AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr);
|
||||||
|
@ -339,6 +339,22 @@ ElementData::TerminalType ElementData::terminalTypeFromString(const QString &str
|
|||||||
return ElementData::TTGeneric;
|
return ElementData::TTGeneric;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ElementData::translatedTerminalType(ElementData::TerminalType type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case ElementData::TTGeneric :
|
||||||
|
return QObject::tr("generique", "generic terminal element type");
|
||||||
|
case ElementData::TTFuse :
|
||||||
|
return QObject::tr("fusible", "fuse terminal element type");
|
||||||
|
case ElementData::TTSectional:
|
||||||
|
return QObject::tr("sectionable", "sectional terminal element type");
|
||||||
|
case ElementData::TTDiode:
|
||||||
|
return QObject::tr("diode", "diode terminal element type");
|
||||||
|
case ElementData::TTGround:
|
||||||
|
return QObject::tr("terre", "ground terminal element type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString ElementData::terminalFunctionToString(ElementData::TerminalFunction function)
|
QString ElementData::terminalFunctionToString(ElementData::TerminalFunction function)
|
||||||
{
|
{
|
||||||
switch (function) {
|
switch (function) {
|
||||||
|
@ -108,6 +108,7 @@ class ElementData : public PropertiesInterface
|
|||||||
|
|
||||||
static QString terminalTypeToString(ElementData::TerminalType type);
|
static QString terminalTypeToString(ElementData::TerminalType type);
|
||||||
static ElementData::TerminalType terminalTypeFromString(const QString &string);
|
static ElementData::TerminalType terminalTypeFromString(const QString &string);
|
||||||
|
static QString translatedTerminalType(ElementData::TerminalType type);
|
||||||
|
|
||||||
static QString terminalFunctionToString(ElementData::TerminalFunction function);
|
static QString terminalFunctionToString(ElementData::TerminalFunction function);
|
||||||
static ElementData::TerminalFunction terminalFunctionFromString(const QString &string);
|
static ElementData::TerminalFunction terminalFunctionFromString(const QString &string);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user