[qet] [2680] folio report can be linked (basic) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2680
Author: blacksun
Date: 2013-12-29 19:37:34 +0100 (Sun, 29 Dec 2013)
Log Message:
-----------
folio report can be linked (basic)
Modified Paths:
--------------
trunk/sources/qetgraphicsitem/element.h
trunk/sources/qetgraphicsitem/reportelement.cpp
trunk/sources/qetgraphicsitem/reportelement.h
trunk/sources/ui/folioreportproperties.cpp
Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h 2013-12-29 18:09:25 UTC (rev 2679)
+++ trunk/sources/qetgraphicsitem/element.h 2013-12-29 18:37:34 UTC (rev 2680)
@@ -81,6 +81,7 @@
/// @return the maximum number of terminals for this element
virtual int maxTerminalsCount() const = 0;
bool isFree () const;
+ virtual void linkToElement(Element *) {}
/**
Draw this element
*/
Modified: trunk/sources/qetgraphicsitem/reportelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.cpp 2013-12-29 18:09:25 UTC (rev 2679)
+++ trunk/sources/qetgraphicsitem/reportelement.cpp 2013-12-29 18:37:34 UTC (rev 2680)
@@ -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 @@
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;
}
Modified: trunk/sources/qetgraphicsitem/reportelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.h 2013-12-29 18:09:25 UTC (rev 2679)
+++ trunk/sources/qetgraphicsitem/reportelement.h 2013-12-29 18:37:34 UTC (rev 2680)
@@ -31,6 +31,7 @@
public :
explicit ReportElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+ virtual void linkToElement(Element *);
virtual int linkType() const;
Modified: trunk/sources/ui/folioreportproperties.cpp
===================================================================
--- trunk/sources/ui/folioreportproperties.cpp 2013-12-29 18:09:25 UTC (rev 2679)
+++ trunk/sources/ui/folioreportproperties.cpp 2013-12-29 18:37:34 UTC (rev 2680)
@@ -66,5 +66,9 @@
* 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);
+ }
}