From 5fe7286998f0fdcca4540e8d5243816364ed07ac Mon Sep 17 00:00:00 2001 From: blacksun Date: Sun, 29 Dec 2013 18:37:34 +0000 Subject: [PATCH] folio report can be linked (basic) git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2680 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/element.h | 1 + sources/qetgraphicsitem/reportelement.cpp | 6 ++++++ sources/qetgraphicsitem/reportelement.h | 1 + sources/ui/folioreportproperties.cpp | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index b145d4a85..83224d611 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -81,6 +81,7 @@ class Element : public QetGraphicsItem { /// @return the maximum number of terminals for this element virtual int maxTerminalsCount() const = 0; bool isFree () const; + virtual void linkToElement(Element *) {} /** Draw this element */ diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp index a18e81bd1..39b957de2 100644 --- a/sources/qetgraphicsitem/reportelement.cpp +++ b/sources/qetgraphicsitem/reportelement.cpp @@ -17,6 +17,7 @@ */ #include "reportelement.h" #include "elementtextitem.h" +#include "diagramposition.h" ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) : CustomElement(location, qgi, s, state) @@ -24,6 +25,11 @@ ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qg texts().at(0)->setNoEditable(); } +void ReportElement::linkToElement(Element * elmt) { + texts().at(0)->setPlainText(QString ("%1-%2").arg(elmt->diagram()->folioIndex() + 1) + .arg(elmt->diagram() -> convertPosition(elmt -> scenePos()).toString())); +} + int ReportElement::linkType() const { return REPORT; } diff --git a/sources/qetgraphicsitem/reportelement.h b/sources/qetgraphicsitem/reportelement.h index 56e797ea9..6e2151cd5 100644 --- a/sources/qetgraphicsitem/reportelement.h +++ b/sources/qetgraphicsitem/reportelement.h @@ -31,6 +31,7 @@ class ReportElement : public CustomElement { public : explicit ReportElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0); + virtual void linkToElement(Element *); virtual int linkType() const; diff --git a/sources/ui/folioreportproperties.cpp b/sources/ui/folioreportproperties.cpp index 81efeda5a..e6d94b719 100644 --- a/sources/ui/folioreportproperties.cpp +++ b/sources/ui/folioreportproperties.cpp @@ -66,5 +66,9 @@ void FolioReportProperties::BuildRadioList() { * Apply the new properties for this folio report */ void FolioReportProperties::Apply() { + if (element_to_link) { + element_to_link->linkToElement(element_); + element_->linkToElement(element_to_link); + } }