mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-18 03:42:36 +02:00
element-editor: no warning on save, when element without terminals is frontview (and fix indention)
This commit is contained in:
@@ -736,11 +736,13 @@ bool QETElementEditor::checkElement()
|
|||||||
QList<QETWarning> warnings;
|
QList<QETWarning> warnings;
|
||||||
QList<QETWarning> errors;
|
QList<QETWarning> errors;
|
||||||
|
|
||||||
// Warning #1: Element haven't got terminal
|
// Warning #1: Element does not have (enough) terminals
|
||||||
// (except for report and conductor definition, because they must have one terminal and this checking is done below)
|
// (except for report and conductor definition, because they must have one terminal and this checking is done below)
|
||||||
|
// (another exception: "thumbnails" aka "front-views" may/should not have terminals)
|
||||||
if (!m_elmt_scene -> containsTerminals() &&
|
if (!m_elmt_scene -> containsTerminals() &&
|
||||||
!(m_elmt_scene->elementData().m_type & ElementData::AllReport) &&
|
!(m_elmt_scene->elementData().m_type & ElementData::AllReport) &&
|
||||||
m_elmt_scene->elementData().m_type != ElementData::ConductorDefinition) {
|
m_elmt_scene->elementData().m_type != ElementData::ConductorDefinition &&
|
||||||
|
m_elmt_scene->elementData().m_type != ElementData::Thumbnail) {
|
||||||
warnings << qMakePair(
|
warnings << qMakePair(
|
||||||
tr("Absence de borne", "warning title"),
|
tr("Absence de borne", "warning title"),
|
||||||
tr(
|
tr(
|
||||||
@@ -749,50 +751,50 @@ bool QETElementEditor::checkElement()
|
|||||||
"warning description"
|
"warning description"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check folio report element
|
// Check folio report element
|
||||||
if (m_elmt_scene->elementData().m_type & ElementData::AllReport)
|
if (m_elmt_scene->elementData().m_type & ElementData::AllReport)
|
||||||
{
|
{
|
||||||
int terminal =0;
|
int terminal =0;
|
||||||
|
|
||||||
for(auto qgi : m_elmt_scene -> items()) {
|
for(auto qgi : m_elmt_scene -> items()) {
|
||||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||||
terminal ++;
|
terminal ++;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Error folio report must have only one terminal
|
|
||||||
if (terminal != 1) {
|
|
||||||
errors << qMakePair (tr("Absence de borne"),
|
|
||||||
tr("<br><b>Erreur</b> :"
|
|
||||||
"<br>Les reports de folio doivent posséder une seul borne."
|
|
||||||
"<br><b>Solution</b> :"
|
|
||||||
"<br>Verifier que l'élément ne possède qu'une seul borne"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check conductor definition element
|
//Error folio report must have only one terminal
|
||||||
if (m_elmt_scene->elementData().m_type == ElementData::ConductorDefinition)
|
if (terminal != 1) {
|
||||||
{
|
errors << qMakePair (tr("Absence de borne"),
|
||||||
int terminal =0;
|
tr("<br><b>Erreur</b> :"
|
||||||
|
"<br>Les reports de folio doivent posséder une seul borne."
|
||||||
|
"<br><b>Solution</b> :"
|
||||||
|
"<br>Verifier que l'élément ne possède qu'une seul borne"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(auto qgi : m_elmt_scene -> items()) {
|
// Check conductor definition element
|
||||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
if (m_elmt_scene->elementData().m_type == ElementData::ConductorDefinition)
|
||||||
terminal ++;
|
{
|
||||||
}
|
int terminal =0;
|
||||||
}
|
|
||||||
|
|
||||||
// Error: Conductor definition must have exactly one terminal
|
for(auto qgi : m_elmt_scene -> items()) {
|
||||||
if (terminal != 1) {
|
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||||
errors << qMakePair (tr("Nombre de bornes incorrect"),
|
terminal ++;
|
||||||
tr("<br><b>Erreur</b> :"
|
|
||||||
"<br>Les définitions de conducteur ne peuvent posséder qu'une seule borne."
|
|
||||||
"<br><b>Solution</b> :"
|
|
||||||
"<br>Vérifier que l'élément ne possède qu'une seule borne"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error: Conductor definition must have exactly one terminal
|
||||||
|
if (terminal != 1) {
|
||||||
|
errors << qMakePair (tr("Nombre de bornes incorrect"),
|
||||||
|
tr("<br><b>Erreur</b> :"
|
||||||
|
"<br>Les définitions de conducteur ne peuvent posséder qu'une seule borne."
|
||||||
|
"<br><b>Solution</b> :"
|
||||||
|
"<br>Vérifier que l'élément ne possède qu'une seule borne"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!errors.count() && !warnings.count()) {
|
if (!errors.count() && !warnings.count()) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user