mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
element editor: check properties for folio report
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3106 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -39,6 +39,9 @@
|
||||
#include "texteditor.h"
|
||||
#include "textfieldeditor.h"
|
||||
|
||||
#include "partterminal.h"
|
||||
#include "parttextfield.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
/*
|
||||
Nombre maximum de primitives affichees par la "liste des parties"
|
||||
@@ -668,12 +671,13 @@ bool QETElementEditor::checkElement() {
|
||||
);
|
||||
}
|
||||
|
||||
///Error #1: element is slave or master but havent got input tagged 'label'
|
||||
/// Check master and slave element
|
||||
if(ce_scene -> elementType() == "master" || ce_scene -> elementType() == "slave") {
|
||||
bool wrng = true;
|
||||
foreach (CustomElementPart *cep, ce_scene->primitives()) {
|
||||
if (cep->property("tagg").toString() == "label") wrng = false;
|
||||
}
|
||||
///Error #1: element is slave or master but havent got input tagged 'label'
|
||||
if (wrng) {
|
||||
errors << qMakePair(
|
||||
tr("Absence de champ texte 'label'", "warning title"),
|
||||
@@ -682,6 +686,30 @@ bool QETElementEditor::checkElement() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Check folio report element
|
||||
if (ce_scene -> elementType().contains("report")) {
|
||||
int text =0, terminal =0;
|
||||
|
||||
foreach(QGraphicsItem *qgi, ce_scene->items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) terminal ++;
|
||||
else if (qgraphicsitem_cast<PartTextField *>(qgi)) text ++;
|
||||
}
|
||||
|
||||
///Error #2 folio report must have only one terminal
|
||||
if (terminal != 1) {
|
||||
errors << qMakePair (
|
||||
tr("Absence de borne"),
|
||||
tr("Les reports de folio doivent poss\351der une seul borne."));
|
||||
}
|
||||
|
||||
///Error #3 folio report must have at least one text
|
||||
if (text <= 0) {
|
||||
errors << qMakePair (
|
||||
tr("Absence de champ texte"),
|
||||
tr("Les reports de folio doivent poss\351der au moins un champ texte \351ditable."));
|
||||
}
|
||||
}
|
||||
|
||||
if (!errors.count() && !warnings.count()) return(true);
|
||||
QList<QETWarning> total = warnings << errors;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user