From d0bafa135f18f4ff577f92035ad7771f2ae8ea7b Mon Sep 17 00:00:00 2001 From: blacksun Date: Tue, 14 Jan 2014 23:09:07 +0000 Subject: [PATCH] folio report properties widget: add two buttons: first see the edited report, second see the linked report (if the edited report is already linked) git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2742 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/ui/folioreportproperties.cpp | 43 +++++++++++++++++++++++----- sources/ui/folioreportproperties.h | 10 +++++-- sources/ui/folioreportproperties.ui | 20 ++++++++++++- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/sources/ui/folioreportproperties.cpp b/sources/ui/folioreportproperties.cpp index 276aecc25..51a79ba4d 100644 --- a/sources/ui/folioreportproperties.cpp +++ b/sources/ui/folioreportproperties.cpp @@ -20,7 +20,10 @@ FolioReportProperties::FolioReportProperties(Element *elmt, QWidget *parent) : { ui->setupUi(this); unlink = false; - if(element_->isFree()) buildRadioList(); + if(element_->isFree()) { + buildRadioList(); + ui->button_linked->setDisabled(true); + } else buildUnlinkButton(); } @@ -39,7 +42,7 @@ void FolioReportProperties::buildRadioList() { sm_ = new QSignalMapper(this); connect(sm_, SIGNAL(mapped(int)), this, SLOT(linkToElement(int))); sm_show_ = new QSignalMapper(this); - connect(sm_show_, SIGNAL(mapped(int)), this, SLOT(showDiagram(int))); + connect(sm_show_, SIGNAL(mapped(int)), this, SLOT(showElementFromList(int))); //Research the invert report of @element_ int rep = element_->linkType() == Element::NextReport? Element::PreviousReport : Element::NextReport; @@ -118,13 +121,39 @@ void FolioReportProperties::unlinkClicked() { } /** - * @brief FolioReportProperties::showDiagram - * Show the wanted report element - * @param i position of wanted element in element_list + * @brief FolioReportProperties::showElement + * Show the required element + * @param elmt: element to be displayed */ -void FolioReportProperties::showDiagram(const int i) { - Element *elmt = element_list.at(i); +void FolioReportProperties::showElement(Element *elmt) { elmt->diagram()->showMe(); foreach (QGraphicsItem *qgi, elmt->diagram()->selectedItems()) qgi->setSelected(false); elmt->setSelected(true); } + +/** + * @brief FolioReportProperties::showElementFromList + * Show element at the position @i from @element_list + * @param i position of element to be displayed + */ +void FolioReportProperties::showElementFromList(const int i) { + if (element_list.size() > i) + showElement(element_list.at(i)); +} + +/** + * @brief FolioReportProperties::on_button_this_clicked + * Action when push button "this report" is clicked + */ +void FolioReportProperties::on_button_this_clicked() { + showElement(element_); +} + +/** + * @brief FolioReportProperties::on_button_linked_clicked + * Action when push button "linked report" is clicked + */ +void FolioReportProperties::on_button_linked_clicked() { + if (element_->isFree()) return; + showElement(element_->linkedElements().first()); +} diff --git a/sources/ui/folioreportproperties.h b/sources/ui/folioreportproperties.h index 1572c1309..604a345f8 100644 --- a/sources/ui/folioreportproperties.h +++ b/sources/ui/folioreportproperties.h @@ -15,16 +15,20 @@ class FolioReportProperties : public QWidget public: explicit FolioReportProperties(Element *elmt, QWidget *parent = 0); ~FolioReportProperties(); - void buildRadioList(); - void buildUnlinkButton(); void Apply(); private slots: void linkToElement(const int i) {element_to_link = element_list.at(i);} void unlinkClicked(); - void showDiagram(const int i); + void showElement(Element *elmt); + void showElementFromList (const int i); + void on_button_this_clicked(); + void on_button_linked_clicked(); private: + void buildRadioList(); + void buildUnlinkButton(); + Element *element_, *element_to_link; QList element_list; Ui::FolioReportProperties *ui; diff --git a/sources/ui/folioreportproperties.ui b/sources/ui/folioreportproperties.ui index 970724c11..4e9ccde50 100644 --- a/sources/ui/folioreportproperties.ui +++ b/sources/ui/folioreportproperties.ui @@ -57,7 +57,7 @@ 0 0 370 - 258 + 224 @@ -74,6 +74,24 @@ + + + + + + Voir ce report + + + + + + + Voir le report liƩ + + + + +