folio report can be linked (basic)

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2680 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2013-12-29 18:37:34 +00:00
parent ea5902fe38
commit 5fe7286998
4 changed files with 12 additions and 0 deletions

View File

@@ -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
*/

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);
}
}