folio report: add user able to make custom label.

Revamp GUI dialog for new diagram configuration.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2749 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-01-18 19:04:39 +00:00
parent 7b83d3dd12
commit e1f9a26f4d
18 changed files with 244 additions and 49 deletions

View File

@@ -26,6 +26,10 @@ ReportElement::ReportElement(const ElementsLocation &location, QString link_type
texts().at(0)->setNoEditable();
link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport;
if (s) {
label_ = s->defaultReportProperties();
connect(s, SIGNAL(reportPropertiesChanged(QString)), this, SLOT(setLabel(QString)));
}
}
ReportElement::~ReportElement() {
@@ -97,6 +101,16 @@ int ReportElement::linkType() const {
return link_type_;
}
/**
* @brief ReportElement::setLabel
* Set new label and call updatelabel
* @param label new label
*/
void ReportElement::setLabel(QString label) {
label_ = label;
updateLabel();
}
/**
* @brief ReportElement::updateLabel
* Update the displayed label.
@@ -105,8 +119,11 @@ int ReportElement::linkType() const {
void ReportElement::updateLabel() {
if (!connected_elements.isEmpty()){
Element *elmt = connected_elements.at(0);
texts().at(0)->setPlainText(QString ("%1-%2").arg(elmt->diagram()->folioIndex() + 1)
.arg(elmt->diagram() -> convertPosition(elmt -> scenePos()).toString()));
QString label = label_;
label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
texts().at(0)->setPlainText(label);
} else {
texts().at(0)->setPlainText("_");
}