diff --git a/sources/elementprovider.cpp b/sources/elementprovider.cpp index 57c5aaf9a..db125f026 100644 --- a/sources/elementprovider.cpp +++ b/sources/elementprovider.cpp @@ -34,10 +34,10 @@ ElementProvider::ElementProvider(QETProject *prj, Diagram *diagram) * All returned element are free, ie element aren't connected with another element * @param filter * the filter for search element - * (the filter must be the enum linkerType in Element.h) + * (You can find all filter with the #define in Element.h) * @return */ -QList ElementProvider::FreeElement(int filter) { +QList ElementProvider::FreeElement(const int filter) const{ QList free_elmt; //serch in all diagram diff --git a/sources/elementprovider.h b/sources/elementprovider.h index 7cc640086..76d1a38a5 100644 --- a/sources/elementprovider.h +++ b/sources/elementprovider.h @@ -32,7 +32,7 @@ class ElementProvider { public: ElementProvider(QETProject *prj, Diagram *diagram=0); - QList FreeElement(int filter); + QList FreeElement(const int filter) const; private: QList diag_list; diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index 8df049758..b145d4a85 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -22,21 +22,21 @@ #include "qetgraphicsitem.h" class Diagram; class ElementTextItem; + +// this define is use to know the kind of element and +// to use flag for element provider class +#define SIMPLE 1 +#define REPORT 2 +#define MASTER 4 +#define SLAVE 8 +#define BORNIER 16 + /** This is the base class for electrical elements. */ class Element : public QetGraphicsItem { Q_OBJECT - - public: - enum linkerType{ - simple = 1, - report = 2, - master = 4, - slave = 8, - bornier = 16 - }; // constructors, destructor public: diff --git a/sources/qetgraphicsitem/ghostelement.h b/sources/qetgraphicsitem/ghostelement.h index 4f5408c52..9b518871e 100644 --- a/sources/qetgraphicsitem/ghostelement.h +++ b/sources/qetgraphicsitem/ghostelement.h @@ -43,7 +43,7 @@ class GhostElement : public CustomElement { // methods public: virtual bool fromXml(QDomElement &, QHash &, bool = false); - virtual int linkType() const {return Element::simple;} + virtual int linkType() const {return SIMPLE;} protected: QRectF minimalBoundingRect() const; diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp index 63acee435..b6f73ebbd 100644 --- a/sources/qetgraphicsitem/reportelement.cpp +++ b/sources/qetgraphicsitem/reportelement.cpp @@ -22,5 +22,5 @@ ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qg {} int ReportElement::linkType() const { - return ReportElement::report; + return REPORT; } diff --git a/sources/qetgraphicsitem/simpleelement.cpp b/sources/qetgraphicsitem/simpleelement.cpp index e85b66d52..291c90792 100644 --- a/sources/qetgraphicsitem/simpleelement.cpp +++ b/sources/qetgraphicsitem/simpleelement.cpp @@ -22,5 +22,5 @@ SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qg {} int SimpleElement::linkType() const { - return SimpleElement::simple; + return SIMPLE; } diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp index 92d6ac0ac..87ae9d64d 100644 --- a/sources/ui/elementpropertieswidget.cpp +++ b/sources/ui/elementpropertieswidget.cpp @@ -90,17 +90,17 @@ void elementpropertieswidget::buildInterface() { //Add tab according to the element switch (element_ -> linkType()) { - case Element::simple: + case SIMPLE: break; - case Element::report: + case REPORT: frp_ = new FolioReportProperties(element_, this); tab_ -> addTab(frp_, tr("Report de folio")); break; - case Element::master: + case MASTER: break; - case Element::slave: + case SLAVE: break; - case Element::bornier: + case BORNIER: break; default: break; diff --git a/sources/ui/folioreportproperties.cpp b/sources/ui/folioreportproperties.cpp index a4f907433..53c5570a5 100644 --- a/sources/ui/folioreportproperties.cpp +++ b/sources/ui/folioreportproperties.cpp @@ -12,14 +12,16 @@ FolioReportProperties::FolioReportProperties(Element *elmt, QWidget *parent) : ui->setupUi(this); ElementProvider ep(element_->diagram()->project(), element_->diagram()); - QList elmt_list = ep.FreeElement(Element::report); + QList elmt_list = ep.FreeElement(REPORT); foreach (Element *elmt, elmt_list) { if (elmt != element_) { QString button_text; - button_text += elmt->name(); - button_text += QString(tr(" Folio\240: %1, ")).arg(elmt->diagram()->folioIndex() + 1); - button_text += QString(tr("Position\240: %1")).arg(elmt->diagram() -> convertPosition(elmt -> scenePos()).toString()); + QString title = elmt->diagram()->title(); + if (title.isEmpty()) title = tr("Sans titre"); + button_text += QString(tr("Folio\240 %1 (%2), position %3.")).arg(elmt->diagram()->folioIndex() + 1) + .arg(title) + .arg(elmt->diagram() -> convertPosition(elmt -> scenePos()).toString()); QRadioButton *rb = new QRadioButton(button_text , this); ui->available_report_layout->addWidget(rb);