Nomenclature export(all fields exported to csv) and Comment field(displayed on editor) handle position and folio variables

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4521 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
dfochi
2016-05-25 14:49:33 +00:00
parent 1a3d0b9ebc
commit 86244e35f0
7 changed files with 28 additions and 23 deletions

View File

@@ -121,7 +121,7 @@ QString nomenclature::getNomenclature()
* @param elmt : the element to getinfo * @param elmt : the element to getinfo
* @return : QString with information about element formated to csv file * @return : QString with information about element formated to csv file
*/ */
QString nomenclature::getElementInfo(const Element *elmt) { QString nomenclature::getElementInfo(Element *elmt) {
QString info; QString info;
Diagram *diagram = elmt -> diagram(); Diagram *diagram = elmt -> diagram();
@@ -132,16 +132,15 @@ QString nomenclature::getElementInfo(const Element *elmt) {
info += diagram -> border_and_titleblock.folio() + ";"; info += diagram -> border_and_titleblock.folio() + ";";
info += elmt -> name() + ";"; info += elmt -> name() + ";";
info += elmt-> diagram()-> convertPosition(elmt -> scenePos()).toString() + ";"; info += elmt-> diagram()-> convertPosition(elmt -> scenePos()).toString() + ";";
info += elmt_info["label"].toString() + ";"; info += elmt->assignVariables(elmt_info["label"].toString(), elmt) + ";";
info += elmt_info["designation"].toString() + ";"; info += elmt->assignVariables(elmt_info["designation"].toString(), elmt) + ";";
info += elmt_info["comment"].toString() + ";"; info += elmt->assignVariables(elmt_info["comment"].toString(), elmt) + ";";
info += elmt_info["manufacturer"].toString() + ";"; info += elmt->assignVariables(elmt_info["manufacturer"].toString(), elmt) + ";";
info += elmt_info["manufacturer-reference"].toString() + ";"; info += elmt->assignVariables(elmt_info["manufacturer-reference"].toString(), elmt) + ";";
info += elmt_info["auxiliary1"].toString() + ";"; info += elmt->assignVariables(elmt_info["auxiliary1"].toString(), elmt) + ";";
info += elmt_info["auxiliary2"].toString() + ";"; info += elmt->assignVariables(elmt_info["auxiliary2"].toString(), elmt) + ";";
info += elmt_info["machine-manufacturer-reference"].toString() + ";"; info += elmt->assignVariables(elmt_info["machine-manufacturer-reference"].toString(), elmt) + ";";
info += elmt_info["location"].toString() + ";"; info += elmt->assignVariables(elmt_info["location"].toString(), elmt) + ";";
info += elmt_info["function"].toString() + "\n"; info += elmt->assignVariables(elmt_info["function"].toString(), elmt) + "\n";
return info; return info;
} }

View File

@@ -56,7 +56,7 @@ class nomenclature
private: private:
QString getNomenclature (); QString getNomenclature ();
QString getElementInfo (const Element *elmt); QString getElementInfo (Element *elmt);
}; };

View File

@@ -535,7 +535,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
*/ */
void CrossRefItem::AddExtraInfo(QPainter &painter) void CrossRefItem::AddExtraInfo(QPainter &painter)
{ {
QString comment = m_element -> elementInformations()["comment"].toString(); QString comment = m_element -> assignVariables(m_element -> elementInformations()["comment"].toString(), m_element);
bool must_show = m_element -> elementInformations().keyMustShow("comment"); bool must_show = m_element -> elementInformations().keyMustShow("comment");
if (!comment.isEmpty() && must_show) if (!comment.isEmpty() && must_show)

View File

@@ -987,11 +987,3 @@ ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
} }
return NULL; return NULL;
} }
QString CustomElement::assignVariables(QString label, Element *elmt){
label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
return label;
}

View File

@@ -93,7 +93,6 @@ class CustomElement : public FixedElement
virtual bool validOrientationAttribute(const QDomElement &); virtual bool validOrientationAttribute(const QDomElement &);
virtual void setPainterStyle(QDomElement &, QPainter &); virtual void setPainterStyle(QDomElement &, QPainter &);
ElementTextItem* setTaggedText(const QString &tagg, const QString &newstr, const bool noeditable=false); ElementTextItem* setTaggedText(const QString &tagg, const QString &newstr, const bool noeditable=false);
QString assignVariables (QString, Element *);
}; };
/** /**

View File

@@ -635,3 +635,17 @@ void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
m_mouse_over = false; m_mouse_over = false;
update(); update();
} }
/**
* @brief Element::assignVariables()
* Assign variables values
* @param label, string to be changed
* @param elmt, element to extract variables values
*/
QString Element::assignVariables(QString label, Element *elmt){
label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
return label;
}

View File

@@ -131,6 +131,7 @@ class Element : public QetGraphicsItem {
DiagramContext kindInformations () const {return kind_informations_;} //@kind_information_ is used to store more information DiagramContext kindInformations () const {return kind_informations_;} //@kind_information_ is used to store more information
//about the herited class like contactelement for know //about the herited class like contactelement for know
// 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 *);
//ATTRIBUTES //ATTRIBUTES
protected: protected: