mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Creation of folio sequential type for Element Autonumbering. Correction of autonumbering type handling in numparteditorw.cpp
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4592 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2016 The QElectroTech Team
|
Copyright 2006-2016 The QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include "elementcollectionhandler.h"
|
#include "elementcollectionhandler.h"
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
|
#include "diagramview.h"
|
||||||
|
|
||||||
const int Diagram::xGrid = 10;
|
const int Diagram::xGrid = 10;
|
||||||
const int Diagram::yGrid = 10;
|
const int Diagram::yGrid = 10;
|
||||||
@@ -79,6 +80,7 @@ Diagram::Diagram(QETProject *project) :
|
|||||||
connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(titleChanged(const QString &)));
|
connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(titleChanged(const QString &)));
|
||||||
connect(&border_and_titleblock, SIGNAL(borderChanged(QRectF,QRectF)), this, SLOT(adjustSceneRect()));
|
connect(&border_and_titleblock, SIGNAL(borderChanged(QRectF,QRectF)), this, SLOT(adjustSceneRect()));
|
||||||
connect(&border_and_titleblock, SIGNAL(titleBlockFolioChanged()), this, SLOT(updateLabels()));
|
connect(&border_and_titleblock, SIGNAL(titleBlockFolioChanged()), this, SLOT(updateLabels()));
|
||||||
|
connect(this, SIGNAL (diagramActivated()), this, SLOT(loadElmtFolioSeq()));
|
||||||
adjustSceneRect();
|
adjustSceneRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,6 +475,28 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
|
|
||||||
//Default New Element
|
//Default New Element
|
||||||
racine.setAttribute("freezeNewElement", m_freeze_new_elements_ ? "true" : "false");
|
racine.setAttribute("freezeNewElement", m_freeze_new_elements_ ? "true" : "false");
|
||||||
|
|
||||||
|
//Folio Sequential Variables
|
||||||
|
if (!m_elmt_unitfolio_max.isEmpty() || !m_elmt_tenfolio_max.isEmpty() || !m_elmt_hundredfolio_max.isEmpty()) {
|
||||||
|
QDomElement folioContainedAutonum = document.createElement("elementautonumfoliosequentials");
|
||||||
|
QHash<QString, QStringList>::iterator i;
|
||||||
|
if (!m_elmt_unitfolio_max.isEmpty()) {
|
||||||
|
QDomElement elmtfolioseq = document.createElement("elementunitfolioseq");
|
||||||
|
elementFolioSequentialsToXml(&m_elmt_unitfolio_max, &elmtfolioseq, "sequf_");
|
||||||
|
folioContainedAutonum.appendChild(elmtfolioseq);
|
||||||
|
}
|
||||||
|
if (!m_elmt_tenfolio_max.isEmpty()) {
|
||||||
|
QDomElement elmtfolioseq = document.createElement("elementtenfolioseq");
|
||||||
|
elementFolioSequentialsToXml(&m_elmt_tenfolio_max, &elmtfolioseq, "seqtf_");
|
||||||
|
folioContainedAutonum.appendChild(elmtfolioseq);
|
||||||
|
}
|
||||||
|
if (!m_elmt_hundredfolio_max.isEmpty()) {
|
||||||
|
QDomElement elmtfolioseq = document.createElement("elementhundredfolioseq");
|
||||||
|
elementFolioSequentialsToXml(&m_elmt_hundredfolio_max, &elmtfolioseq, "seqhf_");
|
||||||
|
folioContainedAutonum.appendChild(elmtfolioseq);
|
||||||
|
}
|
||||||
|
racine.appendChild(folioContainedAutonum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//this method with whole_content to false,
|
//this method with whole_content to false,
|
||||||
@@ -569,6 +593,23 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
return(document);
|
return(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
+ * @brief Diagram::elementFolioSequentialsToXml
|
||||||
|
+ * Add element folio sequential to QDomElement
|
||||||
|
+ * @param domElement to add attributes
|
||||||
|
+ * @param hash to retrieve content with content
|
||||||
|
+ * @param sequential type
|
||||||
|
+ */
|
||||||
|
void Diagram::elementFolioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement, QString seq_type) {
|
||||||
|
QHash<QString, QStringList>::iterator i;
|
||||||
|
for (i = hash->begin(); i != hash->end(); i++) {
|
||||||
|
domElement->setAttribute("title", i.key());
|
||||||
|
for (int j = 0; j < i.value().size(); j++) {
|
||||||
|
domElement->setAttribute(seq_type + QString::number(j+1), i.value().at(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Importe le schema decrit dans un document XML. Si une position est
|
Importe le schema decrit dans un document XML. Si une position est
|
||||||
precisee, les elements importes sont positionnes de maniere a ce que le
|
precisee, les elements importes sont positionnes de maniere a ce que le
|
||||||
@@ -658,8 +699,12 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
|
|
||||||
// Load Freeze New Element
|
// Load Freeze New Element
|
||||||
m_freeze_new_elements_ = root.attribute("freezeNewElement").toInt();
|
m_freeze_new_elements_ = root.attribute("freezeNewElement").toInt();
|
||||||
|
|
||||||
|
elementFolioSequentialsFromXml(root, &m_elmt_unitfolio_max, "elementunitfolioseq","sequf_");
|
||||||
|
elementFolioSequentialsFromXml(root, &m_elmt_tenfolio_max, "elementtenfolioseq","seqtf_");
|
||||||
|
elementFolioSequentialsFromXml(root, &m_elmt_hundredfolio_max, "elementhundredfolioseq","seqhf_");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if child haven't got a child, loading is finish (diagram is empty)
|
// if child haven't got a child, loading is finish (diagram is empty)
|
||||||
if (root.firstChild().isNull()) {
|
if (root.firstChild().isNull()) {
|
||||||
write(document);
|
write(document);
|
||||||
@@ -831,6 +876,27 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::elementFolioSequentialsFromXml
|
||||||
|
* Load element folio sequential from QDomElement
|
||||||
|
* @param root containing all folio sequentials
|
||||||
|
* @param hash to be loaded with content
|
||||||
|
* @param folioSeq type
|
||||||
|
* @param seq type
|
||||||
|
*/
|
||||||
|
void Diagram::elementFolioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq) {
|
||||||
|
foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, "elementautonumfoliosequentials", folioSeq)) {
|
||||||
|
QString title = folioSeqAutoNum.attribute("title");
|
||||||
|
QStringList unit;
|
||||||
|
int i = 1;
|
||||||
|
while (folioSeqAutoNum.hasAttribute(seq + QString::number(i))) {
|
||||||
|
unit << folioSeqAutoNum.attribute(seq + QString::number(i));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
hash->insert(title,unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enregistre le schema XML dans son document XML interne et emet le signal
|
Enregistre le schema XML dans son document XML interne et emet le signal
|
||||||
written().
|
written().
|
||||||
@@ -1073,6 +1139,93 @@ void Diagram::updateLabels() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::insertFolioSeqHash
|
||||||
|
* This class inserts a stringlist containing all
|
||||||
|
* sequential variables related to an autonum in a QHash
|
||||||
|
* @param Hash to be accessed
|
||||||
|
* @param autonum title
|
||||||
|
* @param sequential to be treated
|
||||||
|
* @param type to be treated
|
||||||
|
* @param Numerotation Context to be manipulated
|
||||||
|
*/
|
||||||
|
void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc) {
|
||||||
|
if (project()->elementAutoNumFormula().contains(seq)) {
|
||||||
|
QStringList max;
|
||||||
|
for (int i = 0; i < nc->size(); i++) {
|
||||||
|
if (nc->itemAt(i).at(0) == type) {
|
||||||
|
nc->replaceValue(i, QString::number(nc->itemAt(i).at(3).toInt()));
|
||||||
|
max.append(QString::number(nc->itemAt(i).at(3).toInt() - nc->itemAt(i).at(2).toInt()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hash->insert(title,max);
|
||||||
|
project()->addElementAutoNum(title,*nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::loadElmtFolioSeqHash
|
||||||
|
* This class loads all folio sequential variables
|
||||||
|
* related to the current autonum
|
||||||
|
* @param Hash to be accessed
|
||||||
|
* @param autonum title
|
||||||
|
* @param sequential to be treated
|
||||||
|
* @param type to be treated
|
||||||
|
* @param Numerotation Context to be manipulated
|
||||||
|
*/
|
||||||
|
void Diagram::loadElmtFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc) {
|
||||||
|
if (project()->elementAutoNumFormula().contains(seq)) {
|
||||||
|
int j = 0;
|
||||||
|
for (int i = 0; i < nc->size(); i++) {
|
||||||
|
if (nc->itemAt(i).at(0) == type) {
|
||||||
|
QString new_value;
|
||||||
|
new_value = QString::number(hash->value(title).at(j).toInt() + nc->itemAt(i).at(2).toInt());
|
||||||
|
nc->replaceValue(i,new_value);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
project()->addElementAutoNum(title,*nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::loadElmtFolioSeq
|
||||||
|
* This class loads all folio sequential variables related
|
||||||
|
* to the current autonum
|
||||||
|
*/
|
||||||
|
void Diagram::loadElmtFolioSeq() {
|
||||||
|
//Element
|
||||||
|
QString title = project()->elementCurrentAutoNum();
|
||||||
|
NumerotationContext nc = project()->elementAutoNum(title);
|
||||||
|
//Unit Folio
|
||||||
|
if (m_elmt_unitfolio_max.isEmpty() || !m_elmt_unitfolio_max.contains(title)) {
|
||||||
|
//Insert Initial Value
|
||||||
|
insertFolioSeqHash(&m_elmt_unitfolio_max,title,"%sequf_","unitfolio",&nc);
|
||||||
|
}
|
||||||
|
else if (m_elmt_unitfolio_max.contains(title)) {
|
||||||
|
//Load Folio Current Value
|
||||||
|
loadElmtFolioSeqHash(&m_elmt_unitfolio_max,title,"%sequf_","unitfolio",&nc);
|
||||||
|
}
|
||||||
|
//Ten Folio
|
||||||
|
if (m_elmt_tenfolio_max.isEmpty() || !m_elmt_tenfolio_max.contains(title)) {
|
||||||
|
//Insert Initial Value
|
||||||
|
insertFolioSeqHash(&m_elmt_tenfolio_max,title,"%seqtf_","tenfolio",&nc);
|
||||||
|
}
|
||||||
|
else if (m_elmt_tenfolio_max.contains(title)) {
|
||||||
|
//Load Folio Current Value
|
||||||
|
loadElmtFolioSeqHash(&m_elmt_tenfolio_max,title,"%seqtf_","tenfolio",&nc);
|
||||||
|
}
|
||||||
|
//Hundred Folio
|
||||||
|
if (m_elmt_hundredfolio_max.isEmpty() || !m_elmt_hundredfolio_max.contains(title)) {
|
||||||
|
//Insert Initial Value
|
||||||
|
insertFolioSeqHash(&m_elmt_hundredfolio_max,title,"%seqhf_","hundredfolio",&nc);
|
||||||
|
}
|
||||||
|
else if (m_elmt_hundredfolio_max.contains(title)) {
|
||||||
|
//Load Folio Current Value
|
||||||
|
loadElmtFolioSeqHash(&m_elmt_hundredfolio_max,title,"%seqhf_","hundredfolio",&nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return le titre du cartouche
|
@return le titre du cartouche
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ class Diagram : public QGraphicsScene
|
|||||||
static const qreal margin;
|
static const qreal margin;
|
||||||
/// background color of diagram
|
/// background color of diagram
|
||||||
static QColor background_color;
|
static QColor background_color;
|
||||||
|
/// Hash containing max values for folio sequential autonums in this diagram
|
||||||
|
QHash <QString, QStringList> m_elmt_unitfolio_max;
|
||||||
|
QHash <QString, QStringList> m_elmt_tenfolio_max;
|
||||||
|
QHash <QString, QStringList> m_elmt_hundredfolio_max;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGraphicsLineItem *conductor_setter_;
|
QGraphicsLineItem *conductor_setter_;
|
||||||
@@ -153,8 +157,10 @@ class Diagram : public QGraphicsScene
|
|||||||
void write(const QDomElement &);
|
void write(const QDomElement &);
|
||||||
bool wasWritten() const;
|
bool wasWritten() const;
|
||||||
QDomElement writeXml(QDomDocument &) const;
|
QDomElement writeXml(QDomDocument &) const;
|
||||||
|
void elementFolioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, QString);
|
||||||
// methods related to graphics items addition/removal on the diagram
|
void elementFolioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, QString, QString);
|
||||||
|
|
||||||
|
// methods related to graphics items addition/removal on the diagram
|
||||||
void initElementsLinks();
|
void initElementsLinks();
|
||||||
virtual void addItem (QGraphicsItem *item);
|
virtual void addItem (QGraphicsItem *item);
|
||||||
virtual void removeItem (QGraphicsItem *item);
|
virtual void removeItem (QGraphicsItem *item);
|
||||||
@@ -202,12 +208,17 @@ class Diagram : public QGraphicsScene
|
|||||||
QUndoStack &undoStack();
|
QUndoStack &undoStack();
|
||||||
QGIManager &qgiManager();
|
QGIManager &qgiManager();
|
||||||
|
|
||||||
|
//methods related to element label Update Policy
|
||||||
void freezeElements();
|
void freezeElements();
|
||||||
void unfreezeElements();
|
void unfreezeElements();
|
||||||
void freezeNew();
|
void freezeNew();
|
||||||
void unfreezeNew();
|
void unfreezeNew();
|
||||||
bool freezeNewElements();
|
bool freezeNewElements();
|
||||||
|
|
||||||
|
//methods related to insertion and loading of element folio sequential
|
||||||
|
void insertFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc);
|
||||||
|
void loadElmtFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void adjustSceneRect ();
|
void adjustSceneRect ();
|
||||||
void titleChanged(const QString &);
|
void titleChanged(const QString &);
|
||||||
@@ -216,6 +227,7 @@ class Diagram : public QGraphicsScene
|
|||||||
void titleBlockTemplateRemoved(const QString &, const QString & = QString());
|
void titleBlockTemplateRemoved(const QString &, const QString & = QString());
|
||||||
void setTitleBlockTemplate(const QString &);
|
void setTitleBlockTemplate(const QString &);
|
||||||
void updateLabels();
|
void updateLabels();
|
||||||
|
void loadElmtFolioSeq();
|
||||||
|
|
||||||
// methods related to graphics items selection
|
// methods related to graphics items selection
|
||||||
void selectAll();
|
void selectAll();
|
||||||
@@ -231,6 +243,7 @@ class Diagram : public QGraphicsScene
|
|||||||
void editElementRequired(const ElementsLocation &); /// Signal emitted when users wish to edit an element from the diagram
|
void editElementRequired(const ElementsLocation &); /// Signal emitted when users wish to edit an element from the diagram
|
||||||
void reportPropertiesChanged(QString);
|
void reportPropertiesChanged(QString);
|
||||||
void XRefPropertiesChanged();
|
void XRefPropertiesChanged();
|
||||||
|
void diagramActivated();
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(Diagram *)
|
Q_DECLARE_METATYPE(Diagram *)
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ void DiagramEventAddElement::addElement()
|
|||||||
can.numerate();
|
can.numerate();
|
||||||
};
|
};
|
||||||
m_diagram -> undoStack().push(undo_object);
|
m_diagram -> undoStack().push(undo_object);
|
||||||
element->setSeq();
|
element->setSequential();
|
||||||
element->freezeNewAddedElement();
|
element->freezeNewAddedElement();
|
||||||
element->updateLabel();
|
element->updateLabel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ void NumerotationContext::clear () {
|
|||||||
* @param increase the increase number of value
|
* @param increase the increase number of value
|
||||||
* @return true if value is append
|
* @return true if value is append
|
||||||
*/
|
*/
|
||||||
bool NumerotationContext::addValue(const QString &type, const QVariant &value, const int increase) {
|
bool NumerotationContext::addValue(const QString &type, const QVariant &value, const int increase, const int initialvalue) {
|
||||||
if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String)) return false;
|
if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String)) return false;
|
||||||
if (keyIsNumber(type) && !value.canConvert(QVariant::Int)) return false;
|
if (keyIsNumber(type) && !value.canConvert(QVariant::Int)) return false;
|
||||||
|
|
||||||
QString valuestr = value.toString();
|
QString valuestr = value.toString();
|
||||||
valuestr.remove("|");
|
valuestr.remove("|");
|
||||||
content_ << type + "|" + valuestr + "|" + QString::number(increase);
|
content_ << type + "|" + valuestr + "|" + QString::number(increase) + "|" + QString::number(initialvalue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ QStringList NumerotationContext::itemAt(const int i) const {
|
|||||||
* @return all type use to numerotation
|
* @return all type use to numerotation
|
||||||
*/
|
*/
|
||||||
QString NumerotationContext::validRegExpNum () const {
|
QString NumerotationContext::validRegExpNum () const {
|
||||||
return ("unit|ten|hundred|string|idfolio|folio|elementline|elementcolumn|elementprefix");
|
return ("unit|unitfolio|ten|hundred|string|idfolio|folio|elementline|elementcolumn|elementprefix");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +107,7 @@ QString NumerotationContext::validRegExpNum () const {
|
|||||||
* @return all type represents a number
|
* @return all type represents a number
|
||||||
*/
|
*/
|
||||||
QString NumerotationContext::validRegExpNumber() const {
|
QString NumerotationContext::validRegExpNumber() const {
|
||||||
return ("unit|ten|hundred");
|
return ("unit|unitfolio|ten|hundred");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,6 +138,11 @@ QDomElement NumerotationContext::toXml(QDomDocument &d, QString str) {
|
|||||||
part.setAttribute("type", strl.at(0));
|
part.setAttribute("type", strl.at(0));
|
||||||
part.setAttribute("value", strl.at(1));
|
part.setAttribute("value", strl.at(1));
|
||||||
part.setAttribute("increase", strl.at(2));
|
part.setAttribute("increase", strl.at(2));
|
||||||
|
if (strl.at(0) == ("unitfolio") ||
|
||||||
|
strl.at(0) == ("tenfolio") ||
|
||||||
|
strl.at(0) == ("hundredfolio")) {
|
||||||
|
part.setAttribute("initialvalue", strl.at(3));
|
||||||
|
}
|
||||||
num_auto.appendChild(part);
|
num_auto.appendChild(part);
|
||||||
}
|
}
|
||||||
return num_auto;
|
return num_auto;
|
||||||
@@ -149,5 +154,20 @@ QDomElement NumerotationContext::toXml(QDomDocument &d, QString str) {
|
|||||||
*/
|
*/
|
||||||
void NumerotationContext::fromXml(QDomElement &e) {
|
void NumerotationContext::fromXml(QDomElement &e) {
|
||||||
clear();
|
clear();
|
||||||
foreach(QDomElement qde, QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt());
|
foreach(QDomElement qde, QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief NumerotationContext::replaceValue
|
||||||
|
* This class replaces the current NC field value with content
|
||||||
|
* @param index of NC Item
|
||||||
|
* @param QString content to replace current value
|
||||||
|
*/
|
||||||
|
void NumerotationContext::replaceValue(int index, QString content) {
|
||||||
|
QString sep = "|";
|
||||||
|
QString type = content_[index].split("|").at(0);
|
||||||
|
QString value = content;
|
||||||
|
QString increase = content_[index].split("|").at(2);
|
||||||
|
QString initvalue = content_[index].split("|").at(3);
|
||||||
|
content_[index].replace(content_[index], type + "|" + value + "|" + increase + "|" + initvalue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class NumerotationContext
|
|||||||
NumerotationContext ();
|
NumerotationContext ();
|
||||||
NumerotationContext (QDomElement &);
|
NumerotationContext (QDomElement &);
|
||||||
void clear();
|
void clear();
|
||||||
bool addValue(const QString &, const QVariant & = QVariant(1), const int = 1);
|
bool addValue(const QString &, const QVariant & = QVariant(1), const int = 1, const int = 0);
|
||||||
QString operator[] (const int &) const;
|
QString operator[] (const int &) const;
|
||||||
void operator << (const NumerotationContext &);
|
void operator << (const NumerotationContext &);
|
||||||
int size() const;
|
int size() const;
|
||||||
@@ -45,6 +45,7 @@ class NumerotationContext
|
|||||||
bool keyIsNumber(const QString &) const;
|
bool keyIsNumber(const QString &) const;
|
||||||
QDomElement toXml(QDomDocument &, QString);
|
QDomElement toXml(QDomDocument &, QString);
|
||||||
void fromXml(QDomElement &);
|
void fromXml(QDomElement &);
|
||||||
|
void replaceValue(int, QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList content_;
|
QStringList content_;
|
||||||
|
|||||||
@@ -92,14 +92,26 @@ void NumerotationContextCommands::setNumStrategy(const QString &str) {
|
|||||||
strategy_ = new UnitNum(diagram_);
|
strategy_ = new UnitNum(diagram_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (str == "unitfolio") {
|
||||||
|
strategy_ = new UnitFNum (diagram_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (str == "ten") {
|
else if (str == "ten") {
|
||||||
strategy_ = new TenNum (diagram_);
|
strategy_ = new TenNum (diagram_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (str == "tenfolio") {
|
||||||
|
strategy_ = new TenFNum (diagram_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (str == "hundred") {
|
else if (str == "hundred") {
|
||||||
strategy_ = new HundredNum (diagram_);
|
strategy_ = new HundredNum (diagram_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (str == "hundredfolio") {
|
||||||
|
strategy_ = new HundredFNum (diagram_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (str == "string") {
|
else if (str == "string") {
|
||||||
strategy_ = new StringNum (diagram_);
|
strategy_ = new StringNum (diagram_);
|
||||||
return;
|
return;
|
||||||
@@ -156,7 +168,7 @@ NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, cons
|
|||||||
QStringList strl = nc.itemAt(i);
|
QStringList strl = nc.itemAt(i);
|
||||||
NumerotationContext newnc;
|
NumerotationContext newnc;
|
||||||
QString value = QString::number( (strl.at(1).toInt()) + (strl.at(2).toInt()) );
|
QString value = QString::number( (strl.at(1).toInt()) + (strl.at(2).toInt()) );
|
||||||
newnc.addValue(strl.at(0), value, strl.at(2).toInt());
|
newnc.addValue(strl.at(0), value, strl.at(2).toInt(), strl.at(3).toInt());
|
||||||
return (newnc);
|
return (newnc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +180,7 @@ NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, c
|
|||||||
QStringList strl = nc.itemAt(i);
|
QStringList strl = nc.itemAt(i);
|
||||||
NumerotationContext newnc;
|
NumerotationContext newnc;
|
||||||
QString value = QString::number( (strl.at(1).toInt()) - (strl.at(2).toInt()) );
|
QString value = QString::number( (strl.at(1).toInt()) - (strl.at(2).toInt()) );
|
||||||
newnc.addValue(strl.at(0), value, strl.at(2).toInt());
|
newnc.addValue(strl.at(0), value, strl.at(2).toInt(), strl.at(3).toInt());
|
||||||
return (newnc);
|
return (newnc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +215,37 @@ NumerotationContext UnitNum::previous(const NumerotationContext &nc, const int i
|
|||||||
return (previousNumber(nc, i));
|
return (previousNumber(nc, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
UnitFNum::UnitFNum(Diagram *d):
|
||||||
|
NumStrategy(d)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UnitFNum::toRepresentedString
|
||||||
|
* @return the represented string of num
|
||||||
|
*/
|
||||||
|
QString UnitFNum::toRepresentedString(const QString num) const {
|
||||||
|
return (num);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UnitFNum::next
|
||||||
|
* @return the next NumerotationContext nc at position i
|
||||||
|
*/
|
||||||
|
NumerotationContext UnitFNum::next (const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextNumber(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UnitFNum::previous
|
||||||
|
* @return the previous NumerotationContext nc at posiiton i
|
||||||
|
*/
|
||||||
|
NumerotationContext UnitFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||||
|
return (previousNumber(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
@@ -237,6 +280,41 @@ NumerotationContext TenNum::previous(const NumerotationContext &nc, const int i)
|
|||||||
return (previousNumber(nc, i));
|
return (previousNumber(nc, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
TenFNum::TenFNum (Diagram *d):
|
||||||
|
NumStrategy (d)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TenFNum::toRepresentedString
|
||||||
|
* @return the represented string of num
|
||||||
|
*/
|
||||||
|
QString TenFNum::toRepresentedString(const QString num) const {
|
||||||
|
int numint = num.toInt();
|
||||||
|
QString numstr = num;
|
||||||
|
if (numint<10) numstr.prepend("0");
|
||||||
|
return (numstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TenFNum::next
|
||||||
|
* @return the next NumerotationContext nc at position i
|
||||||
|
*/
|
||||||
|
NumerotationContext TenFNum::next (const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextNumber(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TenFNum::previous
|
||||||
|
* @return the previous NumerotationContext nc at posiiton i
|
||||||
|
*/
|
||||||
|
NumerotationContext TenFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||||
|
return (previousNumber(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
@@ -276,6 +354,45 @@ NumerotationContext HundredNum::previous(const NumerotationContext &nc, const in
|
|||||||
return (previousNumber(nc, i));
|
return (previousNumber(nc, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
HundredFNum::HundredFNum (Diagram *d):
|
||||||
|
NumStrategy (d)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HundredFNum::toRepresentedString
|
||||||
|
* @return the represented string of num
|
||||||
|
*/
|
||||||
|
QString HundredFNum::toRepresentedString(const QString num) const {
|
||||||
|
int numint = num.toInt();
|
||||||
|
QString numstr = num;
|
||||||
|
if (numint<100) {
|
||||||
|
if (numint<10) {
|
||||||
|
numstr.prepend("00");
|
||||||
|
}
|
||||||
|
else numstr.prepend("0");
|
||||||
|
}
|
||||||
|
return (numstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HundredFNum::next
|
||||||
|
* @return the next NumerotationContext nc at position i
|
||||||
|
*/
|
||||||
|
NumerotationContext HundredFNum::next (const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextNumber(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HundredFNum::previous
|
||||||
|
* @return the previous NumerotationContext nc at posiiton i
|
||||||
|
*/
|
||||||
|
NumerotationContext HundredFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||||
|
return (previousNumber(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
@@ -352,7 +469,7 @@ FolioNum::FolioNum (Diagram *d):
|
|||||||
*/
|
*/
|
||||||
QString FolioNum::toRepresentedString(const QString str) const {
|
QString FolioNum::toRepresentedString(const QString str) const {
|
||||||
Q_UNUSED(str);
|
Q_UNUSED(str);
|
||||||
return (diagram_->border_and_titleblock.folio());
|
return ("%F");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ class UnitNum: public NumStrategy
|
|||||||
NumerotationContext previous (const NumerotationContext &, const int) const;
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class UnitFNum: public NumStrategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UnitFNum (Diagram *);
|
||||||
|
QString toRepresentedString(const QString) const;
|
||||||
|
NumerotationContext next (const NumerotationContext &, const int) const;
|
||||||
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
|
};
|
||||||
|
|
||||||
class TenNum: public NumStrategy
|
class TenNum: public NumStrategy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -78,6 +87,15 @@ class TenNum: public NumStrategy
|
|||||||
NumerotationContext previous (const NumerotationContext &, const int) const;
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TenFNum: public NumStrategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TenFNum (Diagram *);
|
||||||
|
QString toRepresentedString(const QString) const;
|
||||||
|
NumerotationContext next (const NumerotationContext &, const int) const;
|
||||||
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
|
};
|
||||||
|
|
||||||
class HundredNum: public NumStrategy
|
class HundredNum: public NumStrategy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -87,6 +105,15 @@ class HundredNum: public NumStrategy
|
|||||||
NumerotationContext previous (const NumerotationContext &, const int) const;
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class HundredFNum: public NumStrategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HundredFNum (Diagram *);
|
||||||
|
QString toRepresentedString(const QString) const;
|
||||||
|
NumerotationContext next (const NumerotationContext &, const int) const;
|
||||||
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
|
};
|
||||||
|
|
||||||
class StringNum: public NumStrategy
|
class StringNum: public NumStrategy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1019,6 +1019,8 @@ void ProjectView::tabChanged(int tab_id) {
|
|||||||
setDisplayFallbackWidget(false);
|
setDisplayFallbackWidget(false);
|
||||||
|
|
||||||
emit(diagramActivated(diagram_ids_[tab_id]));
|
emit(diagramActivated(diagram_ids_[tab_id]));
|
||||||
|
if (diagram_ids_[tab_id] != nullptr)
|
||||||
|
diagram_ids_[tab_id]->diagram()->diagramActivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -954,6 +954,7 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) {
|
|||||||
// met a jour le panel d'elements
|
// met a jour le panel d'elements
|
||||||
if (update_panel) {
|
if (update_panel) {
|
||||||
pa -> elementsPanel().projectWasOpened(project);
|
pa -> elementsPanel().projectWasOpened(project);
|
||||||
|
if (currentDiagram() != NULL)
|
||||||
m_autonumbering_dock->setProject(project, project_view);
|
m_autonumbering_dock->setProject(project, project_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1326,7 +1327,7 @@ void QETDiagramEditor::slot_updateActions()
|
|||||||
void QETDiagramEditor::slot_updateAutoNumDock() {
|
void QETDiagramEditor::slot_updateAutoNumDock() {
|
||||||
if ( workspace.subWindowList().indexOf(workspace.activeSubWindow()) != activeSubWindowIndex) {
|
if ( workspace.subWindowList().indexOf(workspace.activeSubWindow()) != activeSubWindowIndex) {
|
||||||
activeSubWindowIndex = workspace.subWindowList().indexOf(workspace.activeSubWindow());
|
activeSubWindowIndex = workspace.subWindowList().indexOf(workspace.activeSubWindow());
|
||||||
if (currentProject()!=NULL) {
|
if (currentProject() != NULL && currentDiagram() != NULL) {
|
||||||
m_autonumbering_dock->setProject(currentProject()->project(),currentProject());
|
m_autonumbering_dock->setProject(currentProject()->project(),currentProject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -429,26 +429,13 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
//load prefix
|
//load prefix
|
||||||
m_prefix = e.attribute("prefix");
|
m_prefix = e.attribute("prefix");
|
||||||
|
|
||||||
//Load Unit Sequential Values
|
//Load Sequential Values
|
||||||
int i = 0;
|
loadSequential(&e,"sequ_",&seq_unit);
|
||||||
while (!e.attribute("sequ_" + QString::number(i+1)).isEmpty()) {
|
loadSequential(&e,"sequf_",&seq_unitfolio);
|
||||||
seq_unit.append(e.attribute("sequ_" + QString::number(i+1)));
|
loadSequential(&e,"seqt_",&seq_ten);
|
||||||
i++;
|
loadSequential(&e,"seqtf_",&seq_tenfolio);
|
||||||
}
|
loadSequential(&e,"seqh_",&seq_hundred);
|
||||||
|
loadSequential(&e,"seqhf_",&seq_hundredfolio);
|
||||||
//Load Ten Sequential Values
|
|
||||||
i = 0;
|
|
||||||
while (!e.attribute("seqt_" + QString::number(i+1)).isEmpty()) {
|
|
||||||
seq_ten.append(e.attribute("seqt_" + QString::number(i+1)));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Load Hundred Sequential Values
|
|
||||||
i = 0;
|
|
||||||
while (!e.attribute("seqh_" + QString::number(i+1)).isEmpty()) {
|
|
||||||
seq_hundred.append(e.attribute("seqh_" + QString::number(i+1)));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//load informations
|
//load informations
|
||||||
m_element_informations.fromXml(e.firstChildElement("elementInformations"), "elementInformation");
|
m_element_informations.fromXml(e.firstChildElement("elementInformations"), "elementInformation");
|
||||||
@@ -470,6 +457,21 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Load Sequentials to display on element label
|
||||||
|
@param element QDomElement to set Attributes
|
||||||
|
@param Qstring seq to be retrieved
|
||||||
|
@param QStringList list to be inserted values
|
||||||
|
*/
|
||||||
|
void Element::loadSequential(QDomElement* e, QString seq, QStringList* list) {
|
||||||
|
//Load Sequential Values
|
||||||
|
int i = 0;
|
||||||
|
while (!e->attribute(seq + QString::number(i+1)).isEmpty()) {
|
||||||
|
list->append(e->attribute(seq + QString::number(i+1)));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Permet d'exporter l'element en XML
|
Permet d'exporter l'element en XML
|
||||||
@param document Document XML a utiliser
|
@param document Document XML a utiliser
|
||||||
@@ -488,20 +490,36 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
|||||||
// prefix
|
// prefix
|
||||||
element.setAttribute("prefix", m_prefix);
|
element.setAttribute("prefix", m_prefix);
|
||||||
|
|
||||||
//Save Unit Sequential Values
|
// Save Element sequential values to Xml
|
||||||
|
// Save Unit Sequential Values
|
||||||
for (int i = 0; i < seq_unit.size(); i++) {
|
for (int i = 0; i < seq_unit.size(); i++) {
|
||||||
element.setAttribute("sequ_" + QString::number(i+1),seq_unit.at(i));
|
element.setAttribute("sequ_" + QString::number(i+1),seq_unit.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save Ten Sequential Values
|
// Save UnitFolio Sequential Values
|
||||||
|
for (int i = 0; i < seq_unitfolio.size(); i++) {
|
||||||
|
element.setAttribute("sequf_" + QString::number(i+1),seq_unitfolio.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save Ten Sequential Values
|
||||||
for (int i = 0; i < seq_ten.size(); i++) {
|
for (int i = 0; i < seq_ten.size(); i++) {
|
||||||
element.setAttribute("seqt_" + QString::number(i+1),seq_ten.at(i));
|
element.setAttribute("seqt_" + QString::number(i+1),seq_ten.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save Hundred Sequential Values
|
// Save TenFolio Sequential Values
|
||||||
|
for (int i = 0; i < seq_tenfolio.size(); i++) {
|
||||||
|
element.setAttribute("seqtf_" + QString::number(i+1),seq_tenfolio.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save Hundred Sequential Values
|
||||||
for (int i = 0; i < seq_hundred.size(); i++) {
|
for (int i = 0; i < seq_hundred.size(); i++) {
|
||||||
element.setAttribute("seqh_" + QString::number(i+1),seq_hundred.at(i));
|
element.setAttribute("seqh_" + QString::number(i+1),seq_hundred.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save Hundred Sequential Values
|
||||||
|
for (int i = 0; i < seq_hundredfolio.size(); i++) {
|
||||||
|
element.setAttribute("seqhf_" + QString::number(i+1),seq_hundredfolio.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
// position, selection et orientation
|
// position, selection et orientation
|
||||||
element.setAttribute("x", QString("%1").arg(pos().x()));
|
element.setAttribute("x", QString("%1").arg(pos().x()));
|
||||||
@@ -748,10 +766,10 @@ QString Element::assignVariables(QString label, Element *elmt){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Element::setSeq()
|
* @brief Element::setSequential
|
||||||
* Set sequential values to element
|
* Set sequential values to element
|
||||||
*/
|
*/
|
||||||
void Element::setSeq() {
|
void Element::setSequential() {
|
||||||
DiagramContext &dc = this->rElementInformations();
|
DiagramContext &dc = this->rElementInformations();
|
||||||
QString element_currentAutoNum = diagram()->project()->elementCurrentAutoNum();
|
QString element_currentAutoNum = diagram()->project()->elementCurrentAutoNum();
|
||||||
QString formula = diagram()->project()->elementAutoNumFormula();
|
QString formula = diagram()->project()->elementAutoNumFormula();
|
||||||
@@ -759,34 +777,75 @@ void Element::setSeq() {
|
|||||||
NumerotationContext nc = diagram()->project()->elementAutoNum(element_currentAutoNum);
|
NumerotationContext nc = diagram()->project()->elementAutoNum(element_currentAutoNum);
|
||||||
NumerotationContextCommands ncc (nc);
|
NumerotationContextCommands ncc (nc);
|
||||||
if (!nc.isEmpty()) {
|
if (!nc.isEmpty()) {
|
||||||
//Unit Format
|
if (label.contains("%sequ_"))
|
||||||
if (label.contains("%sequ_")) {
|
setSequentialToList(&seq_unit,&nc,"unit");
|
||||||
for (int i = 0; i < nc.size(); i++) {
|
if (label.contains("%sequf_")) {
|
||||||
if (nc.itemAt(i).at(0) == "unit") {
|
setSequentialToList(&seq_unitfolio,&nc,"unitfolio");
|
||||||
seq_unit.append(QString::number(nc.itemAt(i).at(1).toInt()));
|
setFolioSequentialToHash(&seq_unitfolio,&diagram()->m_elmt_unitfolio_max,element_currentAutoNum);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//Ten Format
|
if (label.contains("%seqt_"))
|
||||||
if (label.contains("%seqt_")) {
|
setSequentialToList(&seq_ten,&nc,"ten");
|
||||||
for (int i = 0; i < nc.size(); i++) {
|
if (label.contains("%seqtf_")) {
|
||||||
if (nc.itemAt(i).at(0) == "ten") {
|
setSequentialToList(&seq_tenfolio,&nc,"tenfolio");
|
||||||
QString number = QString ("%1").arg(nc.itemAt(i).at(1).toInt(), 2, 10, QChar('0'));
|
setFolioSequentialToHash(&seq_tenfolio,&diagram()->m_elmt_tenfolio_max,element_currentAutoNum);
|
||||||
seq_ten.append(number);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//Hundred Format
|
if (label.contains("%seqh_"))
|
||||||
if (label.contains("%seqh_")) {
|
setSequentialToList(&seq_hundred,&nc,"hundred");
|
||||||
for (int i = 0; i < nc.size(); i++) {
|
if (label.contains("%seqhf_")) {
|
||||||
if (nc.itemAt(i).at(0) == "hundred") {
|
setSequentialToList(&seq_hundredfolio,&nc,"hundredfolio");
|
||||||
QString number = QString ("%1").arg(nc.itemAt(i).at(1).toInt(), 3, 10, QChar('0'));
|
setFolioSequentialToHash(&seq_hundredfolio,&diagram()->m_elmt_hundredfolio_max,element_currentAutoNum);
|
||||||
seq_hundred.append(number);
|
}
|
||||||
}
|
this->diagram()->project()->addElementAutoNum(element_currentAutoNum,ncc.next());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Element::setSequentialToList
|
||||||
|
* This class appends all sequential to selected list
|
||||||
|
* @param list to have values inserted
|
||||||
|
* @param nc to retrieve values from
|
||||||
|
* @param sequential type
|
||||||
|
*/
|
||||||
|
void Element::setSequentialToList(QStringList* list, NumerotationContext* nc, QString type) {
|
||||||
|
for (int i = 0; i < nc->size(); i++) {
|
||||||
|
if (nc->itemAt(i).at(0) == type) {
|
||||||
|
QString number;
|
||||||
|
if (type == "ten" || type == "tenfolio")
|
||||||
|
number = QString("%1").arg(nc->itemAt(i).at(1).toInt(), 2, 10, QChar('0'));
|
||||||
|
else if (type == "hundred" || type == "hundredfolio")
|
||||||
|
number = QString("%1").arg(nc->itemAt(i).at(1).toInt(), 3, 10, QChar('0'));
|
||||||
|
else number = QString::number(nc->itemAt(i).at(1).toInt());
|
||||||
|
list->append(number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Element::setFolioSequentialToHash
|
||||||
|
* This class inserts all elements from list to hash
|
||||||
|
* @param list to retrieve values from
|
||||||
|
* @param hash to have values inserted
|
||||||
|
* @param current element autonum to insert on hash
|
||||||
|
*/
|
||||||
|
void Element::setFolioSequentialToHash(QStringList* list, QHash<QString, QStringList> *hash, QString element_currentAutoNum) {
|
||||||
|
if (hash->isEmpty() || (!(hash->contains(element_currentAutoNum)))) {
|
||||||
|
QStringList max;
|
||||||
|
for (int i = 0; i < list->size(); i++) {
|
||||||
|
max.append(list->at(i));
|
||||||
|
}
|
||||||
|
hash->insert(element_currentAutoNum,max);
|
||||||
|
}
|
||||||
|
else if (hash->contains(element_currentAutoNum)) {
|
||||||
|
//Load the String List and update it
|
||||||
|
QStringList max = hash->value(element_currentAutoNum);
|
||||||
|
for (int i = 0; i < list->size(); i++) {
|
||||||
|
if ((list->at(i).toInt()) > max.at(i).toInt()) {
|
||||||
|
max.replace(i,list->at(i));
|
||||||
|
hash->remove(element_currentAutoNum);
|
||||||
|
hash->insert(element_currentAutoNum,max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->diagram()->project()->addElementAutoNum(element_currentAutoNum,ncc.next());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -796,7 +855,7 @@ void Element::setSeq() {
|
|||||||
* @return replaced label
|
* @return replaced label
|
||||||
*/
|
*/
|
||||||
QString Element::assignSeq(QString label) {
|
QString Element::assignSeq(QString label) {
|
||||||
for (int i = 1; i <= qMax(seq_unit.size(),qMax(seq_hundred.size(),seq_ten.size())); i++) {
|
for (int i = 1; i <= qMax(qMax(qMax(seq_unitfolio.size(), seq_tenfolio.size()),qMax(seq_hundredfolio.size(),seq_unit.size())),qMax(seq_hundred.size(),seq_ten.size())); i++) {
|
||||||
if (label.contains("%sequ_" + QString::number(i))) {
|
if (label.contains("%sequ_" + QString::number(i))) {
|
||||||
label.replace("%sequ_" + QString::number(i),seq_unit.at(i-1));
|
label.replace("%sequ_" + QString::number(i),seq_unit.at(i-1));
|
||||||
}
|
}
|
||||||
@@ -806,6 +865,15 @@ QString Element::assignSeq(QString label) {
|
|||||||
if (label.contains("%seqh_" + QString::number(i))) {
|
if (label.contains("%seqh_" + QString::number(i))) {
|
||||||
label.replace("%seqh_" + QString::number(i),seq_hundred.at(i-1));
|
label.replace("%seqh_" + QString::number(i),seq_hundred.at(i-1));
|
||||||
}
|
}
|
||||||
|
if (label.contains("%sequf_" + QString::number(i))) {
|
||||||
|
label.replace("%sequf_" + QString::number(i),seq_unitfolio.at(i-1));
|
||||||
|
}
|
||||||
|
if (label.contains("%seqtf_" + QString::number(i))) {
|
||||||
|
label.replace("%seqtf_" + QString::number(i),seq_tenfolio.at(i-1));
|
||||||
|
}
|
||||||
|
if (label.contains("%seqhf_" + QString::number(i))) {
|
||||||
|
label.replace("%seqhf_" + QString::number(i),seq_hundredfolio.at(i-1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class ElementTextItem;
|
|||||||
class QETProject;
|
class QETProject;
|
||||||
class Terminal;
|
class Terminal;
|
||||||
class Conductor;
|
class Conductor;
|
||||||
|
class NumerotationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the base class for electrical elements.
|
This is the base class for electrical elements.
|
||||||
@@ -135,7 +136,9 @@ class Element : public QetGraphicsItem {
|
|||||||
// kind of contact (simple tempo) or number of contact show by the element.
|
// kind of contact (simple tempo) or number of contact show by the element.
|
||||||
QString assignVariables (QString, Element *);
|
QString assignVariables (QString, Element *);
|
||||||
QString assignSeq (QString);
|
QString assignSeq (QString);
|
||||||
void setSeq ();
|
void setSequential ();
|
||||||
|
void setSequentialToList(QStringList*, NumerotationContext*, QString);
|
||||||
|
void setFolioSequentialToHash(QStringList*, QHash<QString, QStringList>*, QString);
|
||||||
void setPrefix(QString);
|
void setPrefix(QString);
|
||||||
QString getPrefix();
|
QString getPrefix();
|
||||||
void freezeLabel();
|
void freezeLabel();
|
||||||
@@ -194,6 +197,7 @@ class Element : public QetGraphicsItem {
|
|||||||
void drawHighlight(QPainter *, const QStyleOptionGraphicsItem *);
|
void drawHighlight(QPainter *, const QStyleOptionGraphicsItem *);
|
||||||
void updatePixmap();
|
void updatePixmap();
|
||||||
void etiToElementLabels(ElementTextItem*);
|
void etiToElementLabels(ElementTextItem*);
|
||||||
|
void loadSequential(QDomElement* e, QString seq, QStringList* list);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent *event );
|
virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent *event );
|
||||||
@@ -205,8 +209,11 @@ class Element : public QetGraphicsItem {
|
|||||||
bool m_mouse_over;
|
bool m_mouse_over;
|
||||||
QString m_prefix;
|
QString m_prefix;
|
||||||
QStringList seq_unit;
|
QStringList seq_unit;
|
||||||
|
QStringList seq_unitfolio;
|
||||||
QStringList seq_ten;
|
QStringList seq_ten;
|
||||||
|
QStringList seq_tenfolio;
|
||||||
QStringList seq_hundred;
|
QStringList seq_hundred;
|
||||||
|
QStringList seq_hundredfolio;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ NumerotationContext QETProject::conductorAutoNum (const QString &key) const {
|
|||||||
* If key is not found, return an empty numerotation context
|
* If key is not found, return an empty numerotation context
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
NumerotationContext QETProject::elementAutoNum (const QString &key) const {
|
NumerotationContext QETProject::elementAutoNum (const QString &key) {
|
||||||
if (m_element_autonum.contains(key)) return m_element_autonum[key];
|
if (m_element_autonum.contains(key)) return m_element_autonum[key];
|
||||||
else return NumerotationContext();
|
else return NumerotationContext();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class QETProject : public QObject
|
|||||||
void removeFolioAutoNum (QString key);
|
void removeFolioAutoNum (QString key);
|
||||||
NumerotationContext conductorAutoNum(const QString &key) const;
|
NumerotationContext conductorAutoNum(const QString &key) const;
|
||||||
NumerotationContext folioAutoNum(const QString &key) const;
|
NumerotationContext folioAutoNum(const QString &key) const;
|
||||||
NumerotationContext elementAutoNum(const QString &key) const;
|
NumerotationContext elementAutoNum(const QString &key);
|
||||||
QString elementAutoNumFormula(const QString key) const; //returns Formula
|
QString elementAutoNumFormula(const QString key) const; //returns Formula
|
||||||
QString elementAutoNumFormula() const;
|
QString elementAutoNumFormula() const;
|
||||||
QString elementCurrentAutoNum () const;
|
QString elementCurrentAutoNum () const;
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ void AutoNumberingDockWidget::on_m_element_cb_activated(int) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
project_->setElementAutoNumCurrentFormula("","");
|
project_->setElementAutoNumCurrentFormula("","");
|
||||||
|
projectview_->currentDiagram()->diagram()->loadElmtFolioSeq();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ NumPartEditorW::NumPartEditorW(QWidget *parent) :
|
|||||||
intValidator (new QIntValidator(0,99999,this))
|
intValidator (new QIntValidator(0,99999,this))
|
||||||
{
|
{
|
||||||
ui -> setupUi(this);
|
ui -> setupUi(this);
|
||||||
if (parentWidget()->parentWidget()->objectName()=="FolioTab") ui->type_combo->setMaxCount(4);
|
setVisibleItems();
|
||||||
else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") ui->type_combo->setMaxCount(6);
|
|
||||||
setType(NumPartEditorW::unit, true);
|
setType(NumPartEditorW::unit, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,16 +42,17 @@ NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, QWidget *pa
|
|||||||
intValidator (new QIntValidator(0,99999,this))
|
intValidator (new QIntValidator(0,99999,this))
|
||||||
{
|
{
|
||||||
ui -> setupUi(this);
|
ui -> setupUi(this);
|
||||||
if (parentWidget()->parentWidget()->objectName()=="FolioTab") ui->type_combo->setMaxCount(4);
|
setVisibleItems();
|
||||||
else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") ui->type_combo->setMaxCount(6);
|
|
||||||
//if @context contains nothing build with default value
|
|
||||||
if(context.size()==0) setType(NumPartEditorW::unit, true);
|
if(context.size()==0) setType(NumPartEditorW::unit, true);
|
||||||
|
|
||||||
else {
|
else {
|
||||||
QStringList strl = context.itemAt(i);
|
QStringList strl = context.itemAt(i);
|
||||||
if (strl.at(0)=="unit") setType(NumPartEditorW::unit, true);
|
if (strl.at(0)=="unit") setType(NumPartEditorW::unit, true);
|
||||||
|
else if (strl.at(0)=="unitfolio") setType(NumPartEditorW::unitfolio, true);
|
||||||
else if (strl.at(0)=="ten") setType(NumPartEditorW::ten, true);
|
else if (strl.at(0)=="ten") setType(NumPartEditorW::ten, true);
|
||||||
|
else if (strl.at(0)=="tenfolio") setType(NumPartEditorW::tenfolio, true);
|
||||||
else if (strl.at(0)=="hundred") setType(NumPartEditorW::hundred, true);
|
else if (strl.at(0)=="hundred") setType(NumPartEditorW::hundred, true);
|
||||||
|
else if (strl.at(0)=="hundredfolio") setType(NumPartEditorW::hundredfolio, true);
|
||||||
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
||||||
else if (strl.at(0)=="idfolio") setType(NumPartEditorW::idfolio);
|
else if (strl.at(0)=="idfolio") setType(NumPartEditorW::idfolio);
|
||||||
else if (strl.at(0)=="folio") setType(NumPartEditorW::folio);
|
else if (strl.at(0)=="folio") setType(NumPartEditorW::folio);
|
||||||
@@ -73,6 +73,27 @@ NumPartEditorW::~NumPartEditorW()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NumPartEditorW::setVisibleItems() {
|
||||||
|
ui->type_cb->setInsertPolicy(QComboBox::InsertAtBottom);
|
||||||
|
QStringList items;
|
||||||
|
if (parentWidget()->parentWidget()->objectName()=="FolioTab") {
|
||||||
|
items << tr("Chiffre 1") << tr("Chiffre 01")
|
||||||
|
<< tr("Chiffre 001")
|
||||||
|
<< tr("Texte") << tr("N° folio");
|
||||||
|
}
|
||||||
|
else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") {
|
||||||
|
items << tr("Chiffre 1") << tr("Chiffre 01")
|
||||||
|
<< tr("Chiffre 001")
|
||||||
|
<< tr("Texte") << tr("N° folio") << tr("Folio");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
|
||||||
|
<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
|
||||||
|
<< tr("Texte") << tr("N° folio") << tr("Folio")
|
||||||
|
<< tr("Element Line") << tr("Element Column") << tr("Element Prefix");
|
||||||
|
ui->type_cb->insertItems(0,items);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief NumPartEditorW::toNumContext
|
* @brief NumPartEditorW::toNumContext
|
||||||
* @return the display to NumerotationContext
|
* @return the display to NumerotationContext
|
||||||
@@ -84,12 +105,21 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
|||||||
case unit:
|
case unit:
|
||||||
type_str = "unit";
|
type_str = "unit";
|
||||||
break;
|
break;
|
||||||
|
case unitfolio:
|
||||||
|
type_str = "unitfolio";
|
||||||
|
break;
|
||||||
case ten:
|
case ten:
|
||||||
type_str = "ten";
|
type_str = "ten";
|
||||||
break;
|
break;
|
||||||
|
case tenfolio:
|
||||||
|
type_str = "tenfolio";
|
||||||
|
break;
|
||||||
case hundred:
|
case hundred:
|
||||||
type_str = "hundred";
|
type_str = "hundred";
|
||||||
break;
|
break;
|
||||||
|
case hundredfolio:
|
||||||
|
type_str = "hundredfolio";
|
||||||
|
break;
|
||||||
case string:
|
case string:
|
||||||
type_str = "string";
|
type_str = "string";
|
||||||
break;
|
break;
|
||||||
@@ -109,6 +139,9 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
|||||||
type_str = "elementprefix";
|
type_str = "elementprefix";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (type_str == "unitfolio" || type_str == "tenfolio" || type_str == "hundredfolio")
|
||||||
|
nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value(), ui->value_field->displayText().toInt());
|
||||||
|
else
|
||||||
nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value());
|
nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value());
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
@@ -125,39 +158,34 @@ bool NumPartEditorW::isValid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief NumPartEditorW::on_type_combo_activated
|
* @brief NumPartEditorW::on_type_cb_activated
|
||||||
* Action when user change the type comboBox
|
* Action when user change the type comboBox
|
||||||
*/
|
*/
|
||||||
void NumPartEditorW::on_type_combo_activated(int index) {
|
void NumPartEditorW::on_type_cb_activated(int) {
|
||||||
switch (index) {
|
if (ui->type_cb->currentText() == tr("Chiffre 1"))
|
||||||
case unit:
|
setType(unit);
|
||||||
setType(unit);
|
else if (ui->type_cb->currentText() == tr("Chiffre 1 - Folio"))
|
||||||
break;
|
setType(unitfolio);
|
||||||
case ten:
|
else if (ui->type_cb->currentText() == tr("Chiffre 01"))
|
||||||
setType(ten);
|
setType(ten);
|
||||||
break;
|
else if (ui->type_cb->currentText() == tr("Chiffre 01 - Folio"))
|
||||||
case hundred:
|
setType(tenfolio);
|
||||||
setType(hundred);
|
else if (ui->type_cb->currentText() == tr("Chiffre 001"))
|
||||||
break;
|
setType(hundred);
|
||||||
case string:
|
else if (ui->type_cb->currentText() == tr("Chiffre 001 - Folio"))
|
||||||
setType(string);
|
setType(hundredfolio);
|
||||||
break;
|
else if (ui->type_cb->currentText() == tr("Texte"))
|
||||||
case idfolio:
|
setType(string);
|
||||||
setType(idfolio);
|
else if (ui->type_cb->currentText() == tr("N° folio"))
|
||||||
break;
|
setType(idfolio);
|
||||||
case folio:
|
else if (ui->type_cb->currentText() == tr("Folio"))
|
||||||
setType(folio);
|
setType(folio);
|
||||||
break;
|
else if (ui->type_cb->currentText() == tr("Element Line"))
|
||||||
case elementline:
|
setType(elementline);
|
||||||
setType(elementline);
|
else if (ui->type_cb->currentText() == tr("Element Column"))
|
||||||
break;
|
setType(elementcolumn);
|
||||||
case elementcolumn:
|
else if (ui->type_cb->currentText() == tr("Element Prefix"))
|
||||||
setType(elementcolumn);
|
setType(elementprefix);
|
||||||
break;
|
|
||||||
case elementprefix:
|
|
||||||
setType(elementprefix);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,11 +212,11 @@ void NumPartEditorW::on_increase_spinBox_valueChanged(int) {
|
|||||||
* @param fnum, force the behavior of numeric type
|
* @param fnum, force the behavior of numeric type
|
||||||
*/
|
*/
|
||||||
void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
||||||
ui -> type_combo -> setCurrentIndex(t);
|
// ui -> type_cb -> setCurrentIndex(t);
|
||||||
|
|
||||||
//if @t is a numeric type and preview type @type_ isn't a numeric type
|
//if @t is a numeric type and preview type @type_ isn't a numeric type
|
||||||
//or @fnum is true, we set numeric behavior
|
//or @fnum is true, we set numeric behavior
|
||||||
if ( ((t==unit || t==ten || t==hundred) &&
|
if ( ((t==unit || t==unitfolio || t==ten || t==tenfolio || t==hundred || t==hundredfolio) &&
|
||||||
(type_==string || type_==folio || type_==idfolio ||
|
(type_==string || type_==folio || type_==idfolio ||
|
||||||
type_==elementcolumn || type_==elementline || type_==elementprefix))
|
type_==elementcolumn || type_==elementline || type_==elementprefix))
|
||||||
|| fnum) {
|
|| fnum) {
|
||||||
|
|||||||
@@ -41,13 +41,20 @@ class NumPartEditorW : public QWidget
|
|||||||
NumPartEditorW (NumerotationContext &, int, QWidget *parent=0);
|
NumPartEditorW (NumerotationContext &, int, QWidget *parent=0);
|
||||||
~NumPartEditorW();
|
~NumPartEditorW();
|
||||||
|
|
||||||
enum type {unit,ten,hundred,string,idfolio,folio,elementline,elementcolumn,elementprefix};
|
enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio,
|
||||||
|
string,idfolio,folio,
|
||||||
|
elementline,elementcolumn,elementprefix,
|
||||||
|
};
|
||||||
NumerotationContext toNumContext();
|
NumerotationContext toNumContext();
|
||||||
bool isValid ();
|
bool isValid ();
|
||||||
type type_;
|
type type_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setVisibleItems();
|
||||||
|
void disableItem(int index);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_type_combo_activated(int);
|
void on_type_cb_activated(int);
|
||||||
void on_value_field_textEdited();
|
void on_value_field_textEdited();
|
||||||
void on_increase_spinBox_valueChanged(int);
|
void on_increase_spinBox_valueChanged(int);
|
||||||
void setType (NumPartEditorW::type t, bool=false);
|
void setType (NumPartEditorW::type t, bool=false);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="type_combo">
|
<widget class="QComboBox" name="type_cb">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -40,51 +40,6 @@
|
|||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Chiffre 1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Chiffre 01</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Chiffre 001</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Texte</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>N° folio</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Folio</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Element Line</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Element Column</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Element Prefix</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -233,8 +233,11 @@ void SelectAutonumW::applyEnable(bool b) {
|
|||||||
void SelectAutonumW::contextToFormula() {
|
void SelectAutonumW::contextToFormula() {
|
||||||
m_eaw->clearContext();
|
m_eaw->clearContext();
|
||||||
int count_unit = 0;
|
int count_unit = 0;
|
||||||
|
int count_unitf = 0;
|
||||||
int count_ten = 0;
|
int count_ten = 0;
|
||||||
|
int count_tenf = 0;
|
||||||
int count_hundred = 0;
|
int count_hundred = 0;
|
||||||
|
int count_hundredf = 0;
|
||||||
foreach (NumPartEditorW *npe, num_part_list_) {
|
foreach (NumPartEditorW *npe, num_part_list_) {
|
||||||
if (npe->isValid()) {
|
if (npe->isValid()) {
|
||||||
if (npe->type_ == NumPartEditorW::idfolio) {
|
if (npe->type_ == NumPartEditorW::idfolio) {
|
||||||
@@ -259,14 +262,26 @@ void SelectAutonumW::contextToFormula() {
|
|||||||
count_unit++;
|
count_unit++;
|
||||||
m_eaw->setContext("%sequ_"+QString::number(count_unit));
|
m_eaw->setContext("%sequ_"+QString::number(count_unit));
|
||||||
}
|
}
|
||||||
|
else if (npe->type_ == NumPartEditorW::unitfolio) {
|
||||||
|
count_unitf++;
|
||||||
|
m_eaw->setContext("%sequf_"+QString::number(count_unitf));
|
||||||
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::ten) {
|
else if (npe->type_ == NumPartEditorW::ten) {
|
||||||
count_ten++;
|
count_ten++;
|
||||||
m_eaw->setContext("%seqt_"+QString::number(count_ten));
|
m_eaw->setContext("%seqt_"+QString::number(count_ten));
|
||||||
}
|
}
|
||||||
|
else if (npe->type_ == NumPartEditorW::tenfolio) {
|
||||||
|
count_tenf++;
|
||||||
|
m_eaw->setContext("%seqtf_"+QString::number(count_tenf));
|
||||||
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::hundred) {
|
else if (npe->type_ == NumPartEditorW::hundred) {
|
||||||
count_hundred++;
|
count_hundred++;
|
||||||
m_eaw->setContext("%seqh_"+QString::number(count_hundred));
|
m_eaw->setContext("%seqh_"+QString::number(count_hundred));
|
||||||
}
|
}
|
||||||
|
else if (npe->type_ == NumPartEditorW::hundredfolio) {
|
||||||
|
count_hundredf++;
|
||||||
|
m_eaw->setContext("%seqhf_"+QString::number(count_hundredf));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user