diff --git a/sources/qetgraphicsitem/diagramtextitem.cpp b/sources/qetgraphicsitem/diagramtextitem.cpp
index 77e35fdc2..561292570 100644
--- a/sources/qetgraphicsitem/diagramtextitem.cpp
+++ b/sources/qetgraphicsitem/diagramtextitem.cpp
@@ -37,6 +37,7 @@ DiagramTextItem::DiagramTextItem(QGraphicsItem *parent, Diagram *parent_diagram)
setDefaultTextColor(Qt::black);
setFont(QETApp::diagramTextsFont());
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable);
+ setNoEditable(false);
#if QT_VERSION >= 0x040600
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
#endif
@@ -59,6 +60,7 @@ DiagramTextItem::DiagramTextItem(const QString &text, QGraphicsItem *parent, Dia
setDefaultTextColor(Qt::black);
setFont(QETApp::diagramTextsFont());
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable);
+ setNoEditable(false);
#if QT_VERSION >= 0x040600
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
#endif
@@ -247,7 +249,7 @@ void DiagramTextItem::focusOutEvent(QFocusEvent *e) {
@param event un QGraphicsSceneMouseEvent decrivant le double-clic
*/
void DiagramTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
- if (!(textInteractionFlags() & Qt::TextEditable)) {
+ if (!(textInteractionFlags() & Qt::TextEditable) && !no_editable) {
// rend le champ de texte editable
setTextInteractionFlags(Qt::TextEditorInteraction);
diff --git a/sources/qetgraphicsitem/diagramtextitem.h b/sources/qetgraphicsitem/diagramtextitem.h
index 86c7862cf..5f17323ce 100644
--- a/sources/qetgraphicsitem/diagramtextitem.h
+++ b/sources/qetgraphicsitem/diagramtextitem.h
@@ -59,6 +59,7 @@ class DiagramTextItem : public QGraphicsTextItem {
QPointF mapMovementToParent(const QPointF &) const;
QPointF mapMovementFromParent(const QPointF &) const;
void setFontSize(int &s);
+ void setNoEditable(bool e = true) {no_editable = e;}
protected:
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
@@ -82,5 +83,6 @@ class DiagramTextItem : public QGraphicsTextItem {
QString previous_text_;
/// angle of rotation of the text field
qreal rotation_angle_;
+ bool no_editable;
};
#endif
diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp
index b6f73ebbd..a18e81bd1 100644
--- a/sources/qetgraphicsitem/reportelement.cpp
+++ b/sources/qetgraphicsitem/reportelement.cpp
@@ -16,10 +16,13 @@
along with QElectroTech. If not, see .
*/
#include "reportelement.h"
+#include "elementtextitem.h"
ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
CustomElement(location, qgi, s, state)
-{}
+{
+ texts().at(0)->setNoEditable();
+}
int ReportElement::linkType() const {
return REPORT;
diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp
index 87ae9d64d..a7709bece 100644
--- a/sources/ui/elementpropertieswidget.cpp
+++ b/sources/ui/elementpropertieswidget.cpp
@@ -14,6 +14,7 @@ elementpropertieswidget::elementpropertieswidget(Element *elmt, QWidget *parent)
element_ (elmt),
diagram_ (elmt->diagram())
{
+ frp_ = 0;
buildInterface();
}
@@ -129,6 +130,7 @@ void elementpropertieswidget::standardButtonClicked(QAbstractButton *button) {
case QDialogButtonBox::ResetRole:
break;
case QDialogButtonBox::ApplyRole:
+ if (frp_) frp_->Apply();
this->accept();
case QDialogButtonBox::RejectRole:
this->reject();
diff --git a/sources/ui/folioreportproperties.cpp b/sources/ui/folioreportproperties.cpp
index 53c5570a5..81efeda5a 100644
--- a/sources/ui/folioreportproperties.cpp
+++ b/sources/ui/folioreportproperties.cpp
@@ -3,19 +3,45 @@
#include
#include
+#include
+/**
+ * @brief FolioReportProperties::FolioReportProperties : Construcor
+ * @param elmt : The edited element
+ * @param parent : Parent widget
+ */
FolioReportProperties::FolioReportProperties(Element *elmt, QWidget *parent) :
QWidget(parent),
element_(elmt),
+ element_to_link(0),
ui(new Ui::FolioReportProperties)
{
ui->setupUi(this);
+ sm_ = new QSignalMapper(this);
+ connect(sm_, SIGNAL(mapped(int)) , this, SLOT(linkToElement(int)));
+
+ BuildRadioList();
+}
+
+/**
+ * @brief FolioReportProperties::~FolioReportProperties : Destructor
+ */
+FolioReportProperties::~FolioReportProperties()
+{
+ delete ui;
+}
+
+/**
+ * @brief FolioReportProperties::BuildRadioList : build the radio list for each available folio report
+ */
+void FolioReportProperties::BuildRadioList() {
ElementProvider ep(element_->diagram()->project(), element_->diagram());
QList elmt_list = ep.FreeElement(REPORT);
foreach (Element *elmt, elmt_list) {
if (elmt != element_) {
+ //label for the button
QString button_text;
QString title = elmt->diagram()->title();
if (title.isEmpty()) title = tr("Sans titre");
@@ -23,14 +49,22 @@ FolioReportProperties::FolioReportProperties(Element *elmt, QWidget *parent) :
.arg(title)
.arg(elmt->diagram() -> convertPosition(elmt -> scenePos()).toString());
+ //button himself
QRadioButton *rb = new QRadioButton(button_text , this);
ui->available_report_layout->addWidget(rb);
+ element_list << elmt;
+ //map the radio button signal
+ connect(rb, SIGNAL(clicked()), sm_, SLOT(map()));
+ sm_ -> setMapping(rb, element_list.size()-1);
}
}
ui->available_report_layout->addStretch();
}
-FolioReportProperties::~FolioReportProperties()
-{
- delete ui;
+/**
+ * @brief FolioReportProperties::Apply
+ * Apply the new properties for this folio report
+ */
+void FolioReportProperties::Apply() {
+
}
diff --git a/sources/ui/folioreportproperties.h b/sources/ui/folioreportproperties.h
index 3b506d549..2bf7d0222 100644
--- a/sources/ui/folioreportproperties.h
+++ b/sources/ui/folioreportproperties.h
@@ -15,10 +15,19 @@ class FolioReportProperties : public QWidget
public:
explicit FolioReportProperties(Element *elmt, QWidget *parent = 0);
~FolioReportProperties();
+ void BuildRadioList();
+ void Apply();
+
+ private slots:
+ void linkToElement(const int i) {element_to_link = element_list.at(i);}
private:
- Element *element_;
+ Element *element_, *element_to_link;
+ QList element_list;
Ui::FolioReportProperties *ui;
+ QSignalMapper *sm_;
+
+
};
#endif // FOLIOREPORTPROPERTIES_H